laravel updated insert into code example
Example 1: eloquent update row response
DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
Example 2: laravel firstorcreate usage
// Retrieve flight by name, or create it if it doesn't exist...
$flight = App\Flight::firstOrCreate(['name' => 'Flight 10']);
// Retrieve flight by name, or create it with the name, delayed, and arrival_time attributes...
$flight = App\Flight::firstOrCreate(
['name' => 'Flight 10'],
['delayed' => 1, 'arrival_time' => '11:30']
);