mardi 1 novembre 2016

column overridden by another column with same name when using join method in eloquent

i'm trying to join a table using eloquent but both tables have a column with the same name => 'id', therefore in the result set only the 'id' table for the joined table is shown. how can i fix this ? i want the only the 'id' column of the first table. below is my query :

 DB::table('ads')->whereUser_id(2)->where('status' , "active")->join('adpictures' , 'ads.id' , '=' , 'adpictures.ad_id')->groupBy('ads.id')->get()

The 'id' column for the ads table is replaced by the 'id' column of the adspicture table.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire