1 | <?php |
||
8 | class UpdateFormRequest extends FormRequest |
||
9 | { |
||
10 | /** |
||
11 | * Determine if the user is authorized to make this request. |
||
12 | * |
||
13 | * @return bool |
||
14 | */ |
||
15 | public function authorize() |
||
16 | { |
||
17 | $model = resolve('App\\User'); |
||
18 | $user = $model::find($this->route('user')); |
||
19 | return $user && auth()->user()->can('update', $user); |
||
|
|||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Get the validation rules that apply to the request. |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | public function rules() |
||
41 | |||
42 | /** |
||
43 | * Get custom messages for validator errors. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | public function messages() |
||
51 | } |
||
52 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: