I want to know if I can use this:
User::update($id,array(
'username '=>Input::get('username'),
'email '=>Input::get('email ')
));
Insted of this:
$user = User::find($id);
$user->username =Input::get('username');
$user->email = Input::get('email ');
$user->save();
I tried but I'm getting the next error: Non-static method Illuminate\Database\Eloquent\Model::update() should not be called statically, assuming $this from incompatible context
User::where('id', $id)->update(array('username' => Input::get('username'), 'email' => Input::get('email')));
Quick one to do, if you are using CRUD with resource controllers
$input = $request->all();
$user = User::findorfail($id);
$updateNow = $user->update($input);
megadola said:
Quick one to do, if you are using CRUD with resource controllers
$input = $request->all(); $user = User::findorfail($id); $updateNow = $user->update($input);
thanks. it worked!
Sign in to participate in this thread!