Hello @mia-gh
In the update function of your controller you have 'user_id'=>'required',
while the user_id isn't part of the edit form. If you want to update the user_id you need to add it to the form. Else you need to remove it from the validation part.
ps. I have updated your post to have the codeblocks working :)
Thanks you for your kind reply. I deleted the user_id from the controller so I don't get this message, if I would like to keep it , what is the specific code for the edit file ? and thank you for the codeblocks, how did you make it ? (i am a real beginner...) have a nice day!
<div class="col-xs-12 col-sm-12 col-md-12 pb-5">
<label class="font-bold text-lg">Select User:</label>
<div class="form-group">
<select class="form-control w-full text-black" name="user_id">
<option value="" selected disabled>Select a user</option>
@if($users)
@foreach ($users as $user)
<option value="{{ $user->id }}">{{ $user->name}}</option>
@endforeach
@endif
</select>
</div>
</div>
in controller
public function edit (Info $info)
{
$users = User::get();
return view('infos.edit',compact('info',users));
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community