marshmallow / actions-change-sequence
A Nova action to change the sequence of resources more easily
Installs: 4 943
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 2
Requires
- php: ^8.0
- laravel/nova: ^4.0
This package is auto-updated.
Last update: 2024-10-30 01:59:32 UTC
README
Laravel Nova Change Sequence
Update the sequences on your resource in Laravel Nova. This package currently supports:
- Place at the top
- Place at the bottom
- Place in location
Installatie
composer require marshmallow/actions-change-sequence
Usage
public function actions(Request $request) { return array_merge([ // ], SequenceActions::make()); }
If you want to sequence a group op items in a resources you can use the group()
method. For instance; if you have a table with invoice items and you want to change the order of the items on a invoice, you really need to change the sequence of only the items in a certant invoice, not the whole table. See the example below.
public function actions(Request $request) { return array_merge([ // ], SequenceActions::groupBy('invoice_id')->make()); }
By default we will use a sequence ascending
and check for the column sequence
. You can override this in the constructor:
SequenceActions::make('asc', 'sequence'); new SequenceFirst('desc', 'order_column');
Optionaly, you can add every action manualy. We don't recommend this. If you use the shorthand above, this will make sure you will directly profit of new actions added in the future.
public function actions(Request $request) { return [ new SequenceFirst, new SequenceLast, new SequencePlace, ]; }