model where code example
Example 1: laravel create or update
$flight = App\Models\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99, 'discounted' => 1]
);
Example 2: laravel find query
$model = App\Models\Flight::where('legs', '>', 100)->firstOr(function () {
});
Example 3: laravel model::query
Model::where()->get();
Model::query()->where()->get();
Model::query();
Example 4: laravel find query
$model = App\Models\Flight::where('legs', '>', 100)
->firstOr(['id', 'legs'], function () {
});