Skip to content

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

Notifications You must be signed in to change notification settings

morphsteve/nova-order-field

 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 62.7%
  • Vue 33.9%
  • JavaScript 3.4%