HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/ipsremont-demo/app/Http/Requests/Service/CreateServiceRequest.php
<?php

namespace App\Http\Requests\Service;

use App\Http\Requests\Request;
use App\Models\Role;
use Illuminate\Validation\Rule;

/**
 * @property string $user_name
 * @property string $user_email
 * @property string $user_phone
 * @property string $user_additional_phone
 * @property bool $user_access_system
 * @property string $user_additional_email
 * @property int $role
 * @property string $name
 * @property string $country
 * @property string $city
 * @property string $physical_address
 * @property string $inn
 * @property string $additional_info
 * @property bool $display
 * @property int $managers
 * @property int $branch_id
 * @property string $external_id
 * @property string $external_warehouse_id
 */
class CreateServiceRequest extends Request
{

    public function rules(): array
    {
        $user = [
            'user_name' => ['string', 'required', 'max:255'],
            'user_email' => ['required', 'string', 'email', 'max:255', Rule::unique('users', 'email')->whereNull('deleted_at')],
            'user_phone' => ['string', 'required', 'max:255'],
            'user_additional_phone' => ['string', 'nullable', 'max:255'],
            'user_access_system' => ['boolean'],
            'user_additional_email' => ['string', 'nullable', 'max:255'],
            'role' => ['integer', 'required', Rule::exists('roles', 'id')->whereNull('deleted_at')->where('type', Role::service)],
        ];

        $service = [
            'name' => ['string', 'required'],
            'country' => ['string', 'required'],
            'city' => ['string', 'nullable'],
            'physical_address' => ['string', 'required'],
            'inn' => ['string', 'required', Rule::unique('services')->whereNull('deleted_at')],
            'additional_info' => ['string', 'nullable'],
            'display' => ['boolean'],
            'managers' => ['exists:App\User,id', 'nullable'],
            'branch_id' => ['exists:App\Models\Branch,id', 'required'],
            'external_id' => ['string', 'nullable', Rule::unique('services')->whereNull('deleted_at')],
            'external_warehouse_id' => ['string', 'nullable', Rule::unique('services')->whereNull('deleted_at')],
        ];

        return array_merge($user, $service);
    }

}