laravel eloquent update function code example
Example 1: laravel updateOrCreate
$flight = App\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99, 'discounted' => 1]
);
Example 2: laravel create or update
$flight = App\Models\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99, 'discounted' => 1]
);
Example 3: laravel eloquent remove from db
$res=User::where('id',$id)->delete();
Example 4: laravel model::query
Model::where()->get();
Model::query()->where()->get();
Model::query();