test follows
Model::find($id)->update(Request::all());
but you must first add the attribute
protected $guarded = [];
carbal said:
test follows
Model::find($id)->update(Request::all());
but you must first add the attribute
protected $guarded = [];
Rather then adding attributes you don't want to $guarded, I recommend adding the ones you do want to go through into $fillable.
Hey guys, thanks for reply my question. I have tried and finally found this solution. Don't know if this is the best way but i'll post it.
public function update(Pessoas $pessoas, PessoasRequest $request)
{
$input = $request->all(); /* Request all inputs */
$input['titulo'] = $pessoas->switchPessoa($input);
$pessoas->fill($input); /* Fill the inputs with new values */
$pessoas->save(); /* Save the new values in database */
\Session::flash('flash_message', 'Success!');
return redirect('pessoas');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community