marshmallow/actions-change-sequence

A Nova action to change the sequence of resources more easily

v3.1.0 2023-01-16 16:59 UTC

README

alt text

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