如何通过 Eloquent 查询原始数据?
我正在尝试在我的 Laravel 应用程序中进行查询,并且我想对我的查询使用正常结构.这个类要么使用 Eloquent,所以我需要找到一些东西来做一个完全原始的查询.
I am trying to do a query in my Laravel app and I want to use a normal structure for my query. This class either does use Eloquent so I need to find something to do a query totally raw.
可能类似于 Model::query($query);
.只是那行不通.
Might be something like Model::query($query);
. Only that doesn't work.
推荐答案
use DB::statement('your raw query here')
.希望这会有所帮助.
use DB::statement('your raw query here')
. Hope this helps.
相关文章