98 lines
2.3 KiB
PHP
98 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Tour;
|
|
|
|
use App\Enums\Flight\TourType;
|
|
use App\Enums\Tour\TourMode;
|
|
use App\Enums\Tour\TourScope;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
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 [
|
|
'title' => [
|
|
'required',
|
|
'string',
|
|
'max:255'
|
|
],
|
|
'summary' => [
|
|
'required',
|
|
'string'
|
|
],
|
|
'description' => [
|
|
'nullable',
|
|
'string'
|
|
],
|
|
'origin_city_id' => [
|
|
'required',
|
|
'integer',
|
|
'exists:cities,id'
|
|
],
|
|
'destination_city_id' => [
|
|
'required',
|
|
'integer',
|
|
'exists:cities,id',
|
|
'different:origin_city_id'
|
|
],
|
|
'tour_scope' => [
|
|
'required',
|
|
Rule::enum(TourScope::class),
|
|
],
|
|
'tour_mode' => [
|
|
'required',
|
|
Rule::enum(TourMode::class),
|
|
],
|
|
'tour_type' => [
|
|
'required',
|
|
Rule::enum(TourType::class),
|
|
],
|
|
'start_date' => [
|
|
'required',
|
|
'string'
|
|
],
|
|
'end_date' => [
|
|
'required',
|
|
'string'
|
|
],
|
|
'price' => [
|
|
'required',
|
|
'integer',
|
|
'min:0'
|
|
],
|
|
'capacity' => [
|
|
'required',
|
|
'integer',
|
|
'min:1'
|
|
],
|
|
'images' => [
|
|
'nullable',
|
|
'array',
|
|
'max:5',
|
|
],
|
|
|
|
'images.*' => [
|
|
'file',
|
|
'mimes:jpg,jpeg,png,webp',
|
|
'max:800',
|
|
],
|
|
];
|
|
}
|
|
}
|