Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.52 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.52 KB

Nova Order Field

Latest Version on Packagist Total Downloads

Description

A field that adds reordering functionality to your Laravel Nova resource's index using the eloquent-sortable package by Spatie.

Demo

Demo

Installation

This package can be installed through Composer.

composer require michielkempen/nova-order-field

Usage

  1. Follow the usage instructions on the eloquent-sortable repository to make your model sortable.
  2. Add the MichielKempen\NovaOrderField\Orderable trait to your Nova Resource.
  3. Add a public static property called $defaultSortField to your resource, containing your order column.
  4. Add the OrderField to your Nova Resource fields method.

Example

use MichielKempen\NovaOrderField\Orderable;
use MichielKempen\NovaOrderField\OrderField;

class Page extends Resource
{
    use Orderable;
    
    public static $defaultOrderField = 'order';
    
    public function fields(Request $request)
    {
        return [
            OrderField::make('Order'),
        ];
    }
}