97 lines
2.4 KiB
PHP
97 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class TourStoreRequest 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 [
|
|
// 'travel_type_id' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'exists:travel_types,id'
|
|
// ],
|
|
'title' =>
|
|
[
|
|
'required',
|
|
'string',
|
|
'max:200'
|
|
],
|
|
// 'slug' =>
|
|
// ['nullable', 'string',
|
|
// 'max:200',
|
|
// 'regex:/^[a-z0-9-]+$/',
|
|
// 'unique:tours,slug,' . $this->tour
|
|
// ],
|
|
|
|
// 'description' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'string'
|
|
// ],
|
|
// 'duration' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'string',
|
|
// 'max:50'
|
|
// ],
|
|
// 'start_date' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'date'
|
|
// ],
|
|
// 'end_date' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'date',
|
|
// 'after_or_equal:start_date'
|
|
// ],
|
|
'price' =>
|
|
[
|
|
'required',
|
|
'numeric',
|
|
'min:0'
|
|
],
|
|
// 'capacity' =>
|
|
// [
|
|
// 'nullable',
|
|
// 'integer',
|
|
// 'min:0'],
|
|
'images' =>
|
|
[
|
|
'nullable',
|
|
'array'
|
|
],
|
|
'images.*' =>
|
|
[
|
|
'image',
|
|
'mimes:jpeg,png,jpg,webp',
|
|
'max:2048'
|
|
],
|
|
|
|
'status' =>
|
|
[
|
|
'nullable',
|
|
'in:0,1'
|
|
],
|
|
];
|
|
}
|
|
}
|