В api есть Route
Route::get('/hint/{hintId}', 'HintsController@show');
Есть валидатор
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class GetHint extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'hintId' => 'required|integer',
];
}
}
И функция в контроллере
public function show(Request $request)
{
$hint = Hint::where('id', $request->hintId)->first();
return new HintResource($hint);
}
При запросе возвращает
{
"message": "The given data was invalid.",
"errors": {
"hintId": [
"The hint id field is required."
]
}
}
Не могу понять почему не валидирует