How to create custom controller in Laravel Voyager

前端 未结 3 1633
予麋鹿
予麋鹿 2021-01-01 03:13

I am very new in Voyager.

I have got all the controllers inside TCG\\\\Voyager\\\\Http\\\\Controllers while installing Voyager but didn\'t find other co

3条回答
  •  忘掉有多难
    2021-01-01 04:06

    Add this to your model.

    use Illuminate\Database\Eloquent\Builder;

    protected static function boot()
        {
            parent::boot();
            static::addGlobalScope('order', function (Builder $builder) {
                $builder->orderBy('name', 'asc');
            });
    }
    

提交回复
热议问题