I was wondering if it is possible to query using DB
facade but returned as an Eloquent Model.
For example i have this query using db query builder
\DB::table('users')->first();
But after the query I want all results to be an Eloquent model from App\User
same results of this
\App\User::first()
my goal for this question is what if I have complex query that returns a sets of users. Using eloquent model is not really efficient i think that's why I use the query builder for raw querying but I also want the results to be a Eloquent model instance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire