📜  获取原始查询 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:45.794000             🧑  作者: Mango

代码示例6
// Retrieve a model by its primary key...
$flight = App\Models\Flight::find(1);

// Retrieve the first model matching the query constraints...
$flight = App\Models\Flight::where('active', 1)->first();

// Shorthand for retrieving the first model matching the query constraints...
$flight = App\Models\Flight::firstWhere('active', 1);