lundi 29 décembre 2014

Laravel Eloquent How to get first record


Vote count:

0




How to get first record or use ->first() in the following query:



DB::table('campaigns')
->where('campaigns.id_campaign', '=', $id_campaign)
->get();


returns array, i want first object



DB::table('campaigns')
->where('campaigns.id_campaign', '=', $id_campaign)
->first();


this on gives error


also i know i can this



Campaign::find($id_campaign)


but i don't want to use this for some reason



asked 51 secs ago







Laravel Eloquent How to get first record

Aucun commentaire:

Enregistrer un commentaire