Kyslik / column-sortable

Package for handling column sorting in Laravel 5/6/7/8
MIT License
644 stars 105 forks source link

Observers don't work when we use sortable() #114

Closed xxxdannybyrdxxx closed 5 years ago

xxxdannybyrdxxx commented 5 years ago

Little example. Lets add this code in our AppServiceProvider.php (app->Providers->AppServiceProvider)


 /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        \App\Product::retrieved(function($model){
            dd($model);
        });
    }

If we try to get Products: \App\Product::get() we will see result of query. But if we use sortable() method: \App\Product::sortable()->get() we will never see the result of query. How can we fix this?

Kyslik commented 5 years ago

I am unable to replicate this; do see https://github.com/Kyslik/column-sortable-example/commit/642417e2a4b6865b64b0d5faeacf0ec913d7731a and it dd() for me.

Kyslik commented 5 years ago

Closing because of inactivity; feel free to re-open.