PHP code example of 42phoenix42 / nova-order-field

1. Go to this page and download the library: Download 42phoenix42/nova-order-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

42phoenix42 / nova-order-field example snippets


public function buildSortQuery()
{
    return static::query()->where('user_id', $this->user_id);
}

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