Actualización de Laravel donde
User::where('id', $user_id)
->update([
'name' => $name
]);
Snippets
User::where('id', $user_id)
->update([
'name' => $name
]);
$user = User::updateOrCreate(['name' => request()->name], [
'foo' => request()->foo
]);
Flight::where('active', 1)
->where('destination', 'San Diego')
->update(['delayed' => 1]);
DB::table('users')
->updateOrInsert(
['email' => '[email protected]', 'name' => 'John'],
['votes' => '2']
);
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();