feat: add form request validation classes
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AirportStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' =>
|
||||
[
|
||||
'required',
|
||||
'string',
|
||||
'max:150'
|
||||
],
|
||||
'city' =>
|
||||
[
|
||||
'required',
|
||||
'string',
|
||||
'max:100'
|
||||
],
|
||||
'country' =>
|
||||
[
|
||||
'required',
|
||||
'string',
|
||||
'max:100'
|
||||
],
|
||||
'code' =>
|
||||
[
|
||||
'required',
|
||||
'string',
|
||||
'max:10'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// public function messages(): array
|
||||
// {
|
||||
// return [
|
||||
// 'name.required' => 'نام فرودگاه الزامی است.',
|
||||
// 'name.max' => 'نام فرودگاه حداکثر ۱۵۰ کاراکتر باشد.',
|
||||
// 'city.required' => 'نام شهر الزامی است.',
|
||||
// 'city.max' => 'نام شهر حداکثر ۱۰۰ کاراکتر باشد.',
|
||||
// 'country.required' => 'نام کشور الزامی است.',
|
||||
// 'country.max' => 'نام کشور حداکثر ۱۰۰ کاراکتر باشد.',
|
||||
// 'code.required' => 'کد فرودگاه (IATA) الزامی است.',
|
||||
// 'code.max' => 'کد فرودگاه حداکثر ۱۰ کاراکتر باشد.',
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user