Support the ongoing development of Laravel.io →
Input Eloquent Forms
Last updated 2 years ago.
0

test follows

Model::find($id)->update(Request::all());

but you must first add the attribute

protected $guarded = [];
Last updated 9 years ago.
0

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.

0

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');
}
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

phroccon phroccon Joined 25 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.