awesome-nova/tool-actions

v0.2.0 2019-04-24 20:41 UTC

This package is auto-updated.

Last update: 2021-12-25 03:34:01 UTC


README

Latest Version on Github Total Downloads Become a Patron!

  1. Installation
  2. Usage

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require awesome-nova/tool-actions

Usage

class AddCommentAction extends ToolAction
{
    public function name()
    {
        return 'Add New Comment';
    }

    public function label()
    {
        return 'Add comment';
    }

    public function handle(ActionFields $fields)
    {
        Comment::create([
            'comment' => $fields->get('comment')
        ]);
    }

    public function fields()
    {
        return [
            Text::make("Comment")->rules('required')
        ];
    }
}