Update Table Using Laravel Model
Please check the code below and this would solve your problem: Selection::whereId($id)->update($request->all());
Please check the code below and this would solve your problem: Selection::whereId($id)->update($request->all());
It’s easy with Laravel. Just do something like this: $query = User::query(); if ($this == $that) { $query = $query->where(‘this’, ‘that’); } if ($this == $another_thing) { $query = $query->where(‘this’, ‘another_thing’); } if ($this == $yet_another_thing) { $query = $query->orderBy(‘this’); } $results = $query->get();
You can use the Eloquent method touch() for this: //instead of $user->updated_at = DB::raw(‘NOW()’); $user->save(); // simply this: $user->touch();