Also add the validator files that will be inside app/Http/Requests
An example would be:
Car
id
name => required|min:3|max:255
And we would have a CarRequest.php file more or less like this:
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CarRequest 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 [
'name' => 'required|min:3|max:255'
];
}
/**
* Mensagens caso pare nos rules atribuidos
* @return array
*/
public function messages() {
return [
'name.required' => 'The :attribute is required',
'name.min' => 'The :attribute ... :min',
'name.max' => 'The :attribute .... :max',
];
}
}
Also add the validator files that will be inside app/Http/Requests
An example would be:
Car id name => required|min:3|max:255
And we would have a CarRequest.php file more or less like this: