1$user = User::updateOrCreate(['name' => request()->name], [
2 'foo' => request()->foo
3]);
4
1use App\Models\Flight;
2
3$flight = Flight::find(1);
4
5$flight->name = 'Paris to London';
6
7$flight->save();
1$flight = App\Models\Flight::find(1);
2
3$flight->name = 'New Flight Name';
4
5$flight->save();
1DB::table('users')
2 ->updateOrInsert(
3 ['email' => 'john@example.com', 'name' => 'John'],
4 ['votes' => '2']
5 );