Laravel Update, где
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' => 'john@example.com', 'name' => 'John'],
['votes' => '2']
);
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();