如何通过 Eloquent 查询原始数据?

2021-12-26 00:00:00 php laravel laravel-4 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.

相关文章