I'm new on Laravel and as I'm playing around with it I encounter this issue. I have a registration system which worked fine but now I wanted to add a new field in my table (description field for users). However, this description field, I don't want to be filled when the user signs up, I want the user to fill this when he gets on his profile and updates a modal window.
The problem is, if I let that filed empty, I get an error when I sign up saying that the description filed can't be empty.
This is what I use in my UserController in order to update the description field but I'm not sure if is correct.
public function postDesc(Request $request){
$this->validate($request, [
'description' => 'required|min:20'
]);
$user = User::all();
$user->description = $request->input('description');
$user->save();
return redirect()->route('user.profile.edit');
}
This is how I opened the form: {!! Form::open(['method' => 'PUT', 'action' => 'UserController@postDesc', 'class' => 'profile-form']) !!
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire