Skip to content

看起来是不是手册少写了些代码,在form里面要保存order字段? #3

@ghost

Description

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;

class Product extends Model implements Sortable
{
    use SoftDeletes,SortableTrait;

    protected $table = 'product';

    public $sortable = [
        'order_column_name' => 'order',
        'sort_when_creating' => true,
    ];

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions