📜  laravel find by - PHP 代码示例

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

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

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

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