How to create a Eloquent model instance from a raw Object?

后端 未结 3 1830
被撕碎了的回忆
被撕碎了的回忆 2020-12-31 10:18

I need to make a raw database query using Laravel:

$results = DB::select(\"SELECT * FROM members 
    INNER JOIN (several other tables) 
    WHERE (horribly          


        
3条回答
  •  被撕碎了的回忆
    2020-12-31 10:44

    You should definetly use Eloquent to perform that.

    You might declare the relations between the models, and use the where conditions.

    like:

    Member::where(......)->get();
    

    This will return an eloquent instance, and you can do whatever you need.

提交回复
热议问题