Level 60
If validation fails, then Laravel redirects back,
@if($errors->has())
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
@endif
trying to updating profile using patch. but after submit, it come to same route controller
public function update()
{
$data = request()->validate([
'name' => 'required',
'country' => 'required',
'bdate' => '',
'job' => 'required',
'wy' => '',
'description' => '',
'website' => 'url',
'pic' => '',
]);
if(request('pic'));
{
$pic = request('pic')->store('upload/pro_pic', 'public');
$pic2 = ['dd' => $pic];
}
dd($data);
}
view
<div class="card-body">
<form action ="{{ route('profile.update') }}"
enctype="multipart/form-data"
method="post">
@csrf
@method('PATCH')
......................
in web.php, this particular route -
Route::patch('/edit', 'ProfileController@update')->name('profile.update');
If validation fails, then Laravel redirects back,
@if($errors->has())
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
@endif
Please or to participate in this conversation.