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:

enter image description here

how can solve this?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -