I just wanted to update user profile, but when I try to load user data via Laravel 5.3.0 Form Modelling, I only see HTTP ERROR 500, I have printed {{$user}}
it has data in it. Issue was caused by the line below
{!! Form::model($user, ['method' => 'PATCH', 'route' =>['profile.update', $user->id]]) !!}
Full form code below
{!! Form::model($user, ['method' => 'PATCH', 'route' => ['profile.update', $user->id]]) !!}
<div class="form-group">
{!! Form::label('name', 'Name') !!}
{!! Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Enter your name', 'required' => '']) !!}
</div>
<div class="form-group">
{!! Form::label('email', 'Email Address') !!}
{!! Form::input('email', 'email', null, ['class' => 'form-control', 'placeholder' => 'Enter Email ', 'required' => '']) !!}
</div>
{!! Form::close() !!}
Kindly let me know what is wrong with the above.
You should use Route::resource()
or Route::patch()
to build this route. So, just change ::get
to ::patch
.
Also, update()
method should like this, so you'd be able to use form data:
public function update(Request $request)