jeudi 24 novembre 2016

Laravel query help needed

I have a question about Laravel queries, so I have a upload Model and database table which stores all my images. Then there is an Activity Model and database table which stores all my activities. For each activity I want a image.

So my Activity model has a 'uploads_id' column. I wrote the query like this:

$activity_images =  DB::table('uploads')
->join('activities', 'uploads.id', '=', 'activities.upload_id')
->where('uploads.id', '=', 'activities.upload_id')
->get();

It cannot find the right image what am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire