| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- declare(strict_types=1);
- namespace App\Http\Requests;
- use App\Models\Role;
- use Illuminate\Database\Query\Builder;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rule;
- class SaveProductionOrderDeliveryRequest extends FormRequest
- {
- public function authorize(): bool
- {
- return true;
- }
- /** @return array<string, mixed> */
- public function rules(): array
- {
- return [
- 'delivery_date' => ['required', 'date'],
- 'delivery_time' => ['nullable', 'date_format:H:i'],
- 'driver_id' => [
- 'required',
- 'integer',
- Rule::exists('users', 'id')->where(
- fn (Builder $query): Builder => $query
- ->whereIn('role', [Role::DRIVER, Role::BRIGADIER])
- ->whereNull('deleted_at'),
- ),
- ],
- 'carrier' => ['nullable', 'string', 'max:255'],
- 'request_number' => ['nullable', 'string', 'max:100'],
- 'request_date' => ['nullable', 'date'],
- 'carrier_note' => ['nullable', 'string', 'max:5000'],
- 'contact_position' => ['nullable', 'string', 'max:255'],
- 'contact_name' => ['nullable', 'string', 'max:255'],
- 'contact_phone' => ['nullable', 'string', 'max:100'],
- 'desired_time' => ['nullable', 'date_format:H:i'],
- 'access_system' => ['nullable', 'string', 'max:5000'],
- 'unloading_place' => ['nullable', 'string', 'max:5000'],
- 'advance_notice' => ['nullable', 'string', 'max:5000'],
- 'document_signing_method' => ['nullable', 'string', 'max:5000'],
- 'has_passports_and_certificates' => ['required', 'boolean'],
- 'note' => ['nullable', 'string', 'max:10000'],
- 'nav' => ['nullable', 'string', 'max:100'],
- ];
- }
- /** @return array<string, string> */
- public function attributes(): array
- {
- return [
- 'delivery_date' => 'дата доставки',
- 'delivery_time' => 'время доставки',
- 'driver_id' => 'водитель',
- 'request_number' => 'номер заявки',
- 'request_date' => 'дата заявки',
- 'desired_time' => 'желаемое время доставки',
- 'has_passports_and_certificates' => 'наличие паспортов и сертификатов',
- ];
- }
- }
|