working with Laravel 5.6 and going to update current logging user name and password from user table. this is UserController
public function updatesetting(Request $request, Auth()->user()->id)
{
$user = User::findOrFail(Auth()->user()->id);
$this->validate($request, [
'name' => 'required|min:3',
'email' => 'required'
]);
$values = $request->all();
$user->fill($values)->save();
return redirect()->back()->with('info','Your Profile data has been updated successfully');
}
and route for this is,
Route::put('/users/Auth()->user()->id', [
'uses' => 'UserController@updatesetting',
]);
and update urls is
<form class="form-vertical" role="form" method="post" action="">
but when I click update buttons following error is occurred,
Argument 1 passed to App\Http\Controllers\Controller::validate() must be an instance of Illuminate\Http\Request, array given, called in C:\Users\power\Desktop\dddd\app\Http\Controllers\UserController.php on line 122 and defined
in ValidatesRequests.php line 50
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire