HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Users/Requests/UpdateSiteUserRequest.php
<?php

namespace App\Users\Requests;

use App\Addresses\Models\Address;
use App\Products\Rules\isProductable;
use Illuminate\Foundation\Http\FormRequest;
use Komma\KMS\Auth\AuthValidationHelper;
use Komma\KMS\Globalization\Requests\CountryIso3Request;
use Komma\KMS\Globalization\Rules\ValidCountryIso3;

class UpdateSiteUserRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'id'                  => 'sometimes|required|numeric',
            'first_name'          => 'sometimes|required|string',
            'last_name_prefix'    => 'sometimes|string',
            'last_name'           => 'sometimes|string',
            'email'               => 'sometimes|required|string|email',
            'telephone'           => 'sometimes|required|string',
        ];

        if(!empty(request()->get('password'))) $rules['password'] = AuthValidationHelper::setRules()['password'];

        return $rules;
    }

    /**
     * Get the error messages for the defined validation rules.
     *
     * @return array
     */
    public function messages()
    {
        return [
            '*.required_unless' => __('validation.required'),
            'password.regex' => __('KMS::kms_users.lowerCapitalNumber')
        ];
    }
}