loafer/laravel-sortable

Laravel package for sorting models

dev-master 2023-07-06 12:02 UTC

This package is auto-updated.

Last update: 2024-10-06 14:44:37 UTC


README

Installation

composer require loafer/laravel-sortable

Usage

Just add the trait to your model.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use \Loafer\Sortable;
}

Configure sort column name

By default, the package will use sort_order column to store the sort value.

If you want to use another column, just add a sortColumn property to your model.

class Post extends Model
{
    use \Loafer\Sortable;

    public $sortColumn = 'order';
}