📜  laravel 优先或失败 - PHP 代码示例

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

代码示例2
// 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);