Package Data | |
---|---|
Maintainer Username: | Naxon |
Package Create Date: | 2018-09-09 |
Package Last Update: | 2022-02-17 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 15:05:26 |
Package Statistics | |
---|---|
Total Downloads: | 265,411 |
Monthly Downloads: | 460 |
Daily Downloads: | 21 |
Total Stars: | 60 |
Total Watchers: | 1 |
Total Forks: | 23 |
Total Open Issues: | 5 |
This field adds reordering functionality to your resource's index using the awesome eloquent-sortable package by the great people of Spatie.
This package can be installed through Composer.
composer require naxon/nova-field-sortable
Naxon\NovaFieldSortable\Concerns\SortsIndexEntries
trait in your Nova Resource.$defaultSortField
to your resource, containing your sorting column (I recomment adding it in your main app/Nova/Resource.php
file).Naxon\NovaFieldSortable\Sortable
field to your Nova Resource fields
method, using a label and your primary key column.<?php
namespace App\Nova;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Fields\Text;
use Naxon\NovaFieldSortable\Concerns\SortsIndexEntries;
use Naxon\NovaFieldSortable\Sortable;
class Page extends Resource
{
use SortsIndexEntries;
public static $defaultSortField = 'sort_order';
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Title'),
Sortable::make('Order', 'id'),
];
}
}
If you discover any security related issues, please email naxond@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.