fix:change flightd sections
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Enums\FlightStatus;
|
||||
use App\Enums\FlightType;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class FlightUpdateRequest 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 [
|
||||
'arrival_aiport_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:airports,id',
|
||||
],
|
||||
|
||||
'departure_airport_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:airports,id',
|
||||
'different:arrival_aiport_id',
|
||||
],
|
||||
|
||||
'airline_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:airlines,id',
|
||||
],
|
||||
'image' => [
|
||||
'nullable',
|
||||
'image',
|
||||
'mimes:jpg,jpeg,png,webp',
|
||||
'max:2048',
|
||||
],
|
||||
|
||||
|
||||
'title' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
|
||||
'summary' => [
|
||||
'nullable',
|
||||
'string',
|
||||
],
|
||||
|
||||
'flight_type' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
FlightType::DEPARTURE->value,
|
||||
FlightType::RETURN->value,
|
||||
FlightType::ROUNDTRIP->value,
|
||||
]),
|
||||
],
|
||||
|
||||
'departure_time' => [
|
||||
'required',
|
||||
'date',
|
||||
],
|
||||
|
||||
'price' => [
|
||||
'required',
|
||||
'numeric',
|
||||
'min:0',
|
||||
],
|
||||
|
||||
|
||||
'status' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::in([
|
||||
FlightStatus::DISABLE->value,
|
||||
FlightStatus::ENABLE->value,
|
||||
]),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user