fix:change tour sections
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Enums\TourDateStatus;
|
||||
use App\Enums\TourStatus;
|
||||
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',
|
||||
],
|
||||
|
||||
'descriptions' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
|
||||
'origin' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
|
||||
'destination' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
|
||||
'duration' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
|
||||
'price' => [
|
||||
'required',
|
||||
'numeric',
|
||||
'min:0',
|
||||
],
|
||||
|
||||
'status' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
TourStatus::DISABLE->value,
|
||||
TourStatus::ENABLE->value,
|
||||
]),
|
||||
],
|
||||
|
||||
'image' => [
|
||||
'required',
|
||||
'image',
|
||||
'mimes:jpg,jpeg,png,webp',
|
||||
'max:2048',
|
||||
],
|
||||
|
||||
'start_date' => [
|
||||
'required',
|
||||
'date',
|
||||
'after_or_equal:today',
|
||||
],
|
||||
|
||||
'end_date' => [
|
||||
'required',
|
||||
'date',
|
||||
'after_or_equal:start_date',
|
||||
],
|
||||
|
||||
'tour_date_price' => [
|
||||
'required',
|
||||
'numeric',
|
||||
'min:0',
|
||||
],
|
||||
|
||||
'capacity' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
|
||||
'tour_date_status' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
TourDateStatus::DISABLE->value,
|
||||
TourDateStatus::ENABLE->value,
|
||||
]),
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Enums\TourDateStatus;
|
||||
use App\Enums\TourStatus;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TourUpdateRequest 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' => [
|
||||
'nullable',
|
||||
'string',
|
||||
],
|
||||
|
||||
'descriptions' => [
|
||||
'nullable',
|
||||
'string',
|
||||
],
|
||||
|
||||
'origin' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
|
||||
'destination' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
|
||||
'duration' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
|
||||
'price' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:0',
|
||||
],
|
||||
|
||||
'image' => [
|
||||
'nullable',
|
||||
'image',
|
||||
'mimes:jpg,jpeg,png,webp',
|
||||
'max:2048',
|
||||
],
|
||||
|
||||
'status' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
TourStatus::DISABLE->value,
|
||||
TourStatus::ENABLE->value,
|
||||
]),
|
||||
],
|
||||
|
||||
'start_date' => [
|
||||
'required',
|
||||
'date',
|
||||
'after_or_equal:today',
|
||||
],
|
||||
|
||||
'end_date' => [
|
||||
'required',
|
||||
'date',
|
||||
'after_or_equal:start_date',
|
||||
],
|
||||
|
||||
'tour_date_price' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:0',
|
||||
],
|
||||
|
||||
'capacity' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
|
||||
'tour_date_status' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
TourDateStatus::DISABLE->value,
|
||||
TourDateStatus::ENABLE->value,
|
||||
]),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user