marshmallow/actions-change-sequence

A Nova action to change the sequence of resources more easily

v3.0.0 2022-05-10 14:36 UTC

This package is auto-updated.

Last update: 2022-07-10 14:57:48 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

68747470733a2f2f6769746c61622e636f6d2f6d617273686d616c6c6f772d7061636b616765732f6e6f76612f616374696f6e732f6368616e67652d73657175656e63652f2d2f7261772f6d61737465722f7265736f75726365732f73637265656e73686f74732f6f7074696f6e732e706e67

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