Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Oct 31, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 31, 2019

<?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,
    ];

}

@ghost
Copy link
Author

ghost commented Oct 31, 2019

排序没成功,数据库字段值没变

@kk8686
Copy link

kk8686 commented Jul 28, 2020

排序没成功,数据库字段值没变

我开头也没成功,研究了下发现因为我的order字段值全部是默认0,我试着全部改成不同的值,就开始生效了

@joe94113
Copy link

joe94113 commented Aug 3, 2022

@kk8686 感謝測試成功

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants