feat: implement requests
This commit is contained in:
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin\Tours;
|
||||||
|
|
||||||
|
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 [
|
||||||
|
'title' => [
|
||||||
|
'required',
|
||||||
|
'max:256',
|
||||||
|
],
|
||||||
|
|
||||||
|
'image' => [
|
||||||
|
'nullable',
|
||||||
|
'image',
|
||||||
|
'mimes:jpg,jpeg,png,webp',
|
||||||
|
'max:5120',
|
||||||
|
],
|
||||||
|
|
||||||
|
'summary' => [
|
||||||
|
'required',
|
||||||
|
'max:512',
|
||||||
|
],
|
||||||
|
|
||||||
|
'description' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
|
|
||||||
|
'origin' => [
|
||||||
|
'required',
|
||||||
|
'max:200',
|
||||||
|
],
|
||||||
|
|
||||||
|
'destination' => [
|
||||||
|
'required',
|
||||||
|
'max:256',
|
||||||
|
],
|
||||||
|
|
||||||
|
'duration' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:1',
|
||||||
|
],
|
||||||
|
|
||||||
|
'price' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:0',
|
||||||
|
],
|
||||||
|
|
||||||
|
'status' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin\Tours;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class tourUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => [
|
||||||
|
'required',
|
||||||
|
'max:256',
|
||||||
|
],
|
||||||
|
|
||||||
|
'image' => [
|
||||||
|
'nullable',
|
||||||
|
'image',
|
||||||
|
'mimes:jpg,jpeg,png,webp',
|
||||||
|
'max:5120',
|
||||||
|
],
|
||||||
|
|
||||||
|
'summary' => [
|
||||||
|
'required',
|
||||||
|
'max:512',
|
||||||
|
],
|
||||||
|
|
||||||
|
'description' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
|
|
||||||
|
'origin' => [
|
||||||
|
'required',
|
||||||
|
'max:200',
|
||||||
|
],
|
||||||
|
|
||||||
|
'destination' => [
|
||||||
|
'required',
|
||||||
|
'max:256',
|
||||||
|
],
|
||||||
|
|
||||||
|
'duration' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:1',
|
||||||
|
],
|
||||||
|
|
||||||
|
'price' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:0',
|
||||||
|
],
|
||||||
|
|
||||||
|
'status' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user