migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\RestaurantDelivery\Http\Requests\DeliveryZone;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DeliveryZoneStoreRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'slug' => 'required|string|max:255|unique:restaurant_delivery_zones,slug',
|
||||
'description' => 'nullable|string',
|
||||
'color' => ['nullable', 'regex:/^#[A-Fa-f0-9]{6}$/'],
|
||||
'coordinates' => 'required|array',
|
||||
'coordinates.type' => 'required|in:Polygon',
|
||||
'coordinates.coordinates' => 'required|array|min:1',
|
||||
'coordinates.coordinates.0' => 'required|array|min:4',
|
||||
'coordinates.coordinates.0.*' => 'required|array|size:2',
|
||||
'coordinates.coordinates.0.*.0' => 'required|numeric|between:-180,180',
|
||||
'coordinates.coordinates.0.*.1' => 'required|numeric|between:-90,90',
|
||||
'priority' => 'nullable|integer|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
'is_default' => 'nullable|boolean',
|
||||
'max_delivery_distance' => 'nullable|numeric|min:0',
|
||||
'operating_hours' => 'nullable|array',
|
||||
'operating_hours.*.open' => 'nullable|date_format:H:i',
|
||||
'operating_hours.*.close' => 'nullable|date_format:H:i',
|
||||
'operating_hours.*.enabled' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'coordinates.required' => 'Zone polygon is required',
|
||||
'coordinates.coordinates.0.min' => 'Polygon must contain at least 4 points',
|
||||
'coordinates.coordinates.0.*.size' => 'Each coordinate must have longitude and latitude',
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\RestaurantDelivery\Http\Requests\DeliveryZone;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DeliveryZoneUpdateRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'description' => 'nullable|string',
|
||||
'color' => ['nullable', 'regex:/^#[A-Fa-f0-9]{6}$/'],
|
||||
'coordinates' => 'required|array',
|
||||
'coordinates.type' => 'required|in:Polygon',
|
||||
'coordinates.coordinates' => 'required|array|min:1',
|
||||
'coordinates.coordinates.0' => 'required|array|min:4',
|
||||
'coordinates.coordinates.0.*' => 'required|array|size:2',
|
||||
'coordinates.coordinates.0.*.0' => 'required|numeric|between:-180,180',
|
||||
'coordinates.coordinates.0.*.1' => 'required|numeric|between:-90,90',
|
||||
'priority' => 'nullable|integer|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
'is_default' => 'nullable|boolean',
|
||||
'max_delivery_distance' => 'nullable|numeric|min:0',
|
||||
'operating_hours' => 'nullable|array',
|
||||
'operating_hours.*.open' => 'nullable|date_format:H:i',
|
||||
'operating_hours.*.close' => 'nullable|date_format:H:i',
|
||||
'operating_hours.*.enabled' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'coordinates.required' => 'Zone polygon is required',
|
||||
'coordinates.coordinates.0.min' => 'Polygon must contain at least 4 points',
|
||||
'coordinates.coordinates.0.*.size' => 'Each coordinate must have longitude and latitude',
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user