PHP code example of awesome-nova / tool-actions

1. Go to this page and download the library: Download awesome-nova/tool-actions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

awesome-nova / tool-actions example snippets


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('