PHP code example of marshmallow / nova-resource-click

1. Go to this page and download the library: Download marshmallow/nova-resource-click 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/ */

    

marshmallow / nova-resource-click example snippets



  return [

      /**
       * Default action for all resources when click is applied;
       */
      'default' => 'view',
  ];



use Marshmallow\NovaResourceClick\Traits\HasClickAction;

class MyResource extends Resource
{
  use HasClickAction;

  public static $clickAction = 'update';  // Options: view, update, select, ignore

  ...
}


class MyResource extends Resource
{

  /**
   * Get meta information about this resource for client side consumption.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return array<string, mixed>
   */
  public static function additionalInformation(Request $request)
  {
    return [
        'clickAction' => 'update' // Options: view, update, select, ignore
    ];
  }

  ...
}
bash
php artisan vendor:publish --provider="Marshmallow\NovaResourceClick\ToolServiceProvider" --tag="config"