Laravel 5 form request validation returning forbidden error
You are getting Forbidden Error because authorize()
method of form request is returning false:
The issue is this: $clinicId = $this->route('postUpdateAddress');
To access a route parameter value in Form Requests you could do this:
$clinicId = \Route::input('id'); //to get the value of {id}
so authorize()
should look like this:
public function authorize(){ $clinicId = \Route::input('id'); //or $this->route('id'); return Clinic::where('id', $clinicId) ->where('user_id', Auth::id()) ->exists();}
I add this owner confirmation to authorize() method in Request and work
public function authorize(){ return \Auth::check();}