laravel eloquent find by column code example
Example 1: find or fail laravel
$model = App\Models\Flight::findOrFail(1);
$model = App\Models\Flight::where('legs', '>', 100)->firstOrFail();
Example 2: model find by certain column laravel
Table::select('name','surname')->where('id', 1)->get();
Example 3: laravel find query
<?php
$flights = App\Models\Flight::all();
foreach ($flights as $flight) {
echo $flight->name;
}