I need to get first row only when executing raw sql query.
The query is actually a bit long and complicated and so I decided to execute it raw.
$query = 'select name, email from users where id > ?'; // this is quite long and complicated query actually.
return DB::select($query, [ $user_id ])->first();
Using ->first()
gives Call to a member function first() on array
exception.
Is there any way that I get the first row only without updating on the query itself?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire