Laravel Nova icon Nova Packages
R

Resource Click

This package is possibly abandoned. Please proceed with care.

Installation Instructions

Install the package in a Laravel Nova project via Composer:

Install package

composer require marshmallow/nova-resource-click

And set the default action in the config or per resource

Readme

Nova Sortable

Latest Version on Packagist Total Downloads

This Laravel Nova package allows you to define the click action on a Nova resource's index row.

Requirements

  • php: >=8.0
  • laravel/nova: ^4.0

Features

  • Define the action of the click on the index page of the Resource Table row

Screenshots

ResourceClick

Installation

Install the package in a Laravel Nova project via Composer:

# Install package
composer require marshmallow/nova-resource-click

Config

Publish the config file with

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

This is the default content of the config file:

  return [

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

Usage

When the resource does not have a click action configuratored, the default action will be used: 'view' .

Note: This package extends the default TableResourceRow component from Laravel Nova. Any other package that overwrites this component may cause this package to break.

Add the row click action to Nova resource

To apply the 'clickAction' on the individual Resource by adding the HasClickAction trait and adding the $clickAction variable.

use Marshmallow\NovaResourceClick\Traits\HasClickAction;

class MyResource extends Resource
{
  use HasClickAction;

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

  ...
}

Or by using use the additionalInformation feature:

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
    ];
  }

  ...
}

Credits

License

Nova Resource Click is open-sourced software licensed under the MIT license.

Screenshots

Reviews

Rated 5 stars out of 5

By ianrobertsFF on July 7, 2022

Excellent

Back to Top
Added 2 years ago
Last updated 3 Years Ago
Version v1.0.0
Nova Version ^4.0
Composer
Marshmallow/nova-resource-click
GitHub stars 4
Packagist downloads 10,159

Favorites

3 users favorited

Rating

5.00
(out of 5)
★★★★★
★★★★
★★★
★★
2 ratings

Tags

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas