feat: implement tour management logic and add store/update form requests
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Tour;
|
||||
|
||||
use App\Enums\Admin\Tour\TourMode;
|
||||
use App\Enums\Admin\Tour\TourScope;
|
||||
use App\Enums\Admin\Tour\TourType;
|
||||
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',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user