laravel - jQuery datatable with BelongsToMany relationship -
i using https://github.com/yajra/laravel-datatables library integrate datatable laravel.
so have query:
public function query() { $query = auth::user()->cars_as_dispatcher()->wherein('status', [3, 4, 5])->orderby('missions.id', 'desc'); return $this->applyscopes($query); }
with relation:
public function cars_as_dispatcher() { return $this->belongstomany('app\car', 'dispatcher_cars', 'uid', 'car_id')->withtimestamps(); }
the error is:
column exists: 1060 duplicate column name 'id'
because query return 2 id columns:
how can solve this?
Comments
Post a Comment