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/Checkout/Requests/UserDetailsFormRequest.php
<?php

namespace App\Checkout\Requests;

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

class UserDetailsFormRequest 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()
    {
        return [
            //Name / contact details
            'first_name'          => 'required|string',
            'last_name_prefix'      => 'string',
            'last_name'           => 'required|string',
            'email'               => 'required|string|email',
            'phone'               => 'string',

            //Invoice address details
            'invoice_street'              => 'required|string',
            'invoice_house_number'        => 'required|string',
//            'invoice_addition'            => 'required|string',
            'invoice_postal_code'         => 'required|string',
            'invoice_city'                => 'required|string',
            'invoice_country'             => ['required', new ValidCountryIso3()],

            //Shipping address details
            'shipping_street'              => 'required_unless:shipping-address-equals,shippingAddressEquals|string',
            'shipping_house_number'        => 'required_unless:shipping-address-equals,shippingAddressEquals|string',
//            'shipping_addition'            => 'required_unless:shipping_address-equals,shippingAddressEquals|string',
            'shipping_postal_code'         => 'required_unless:shipping-address-equals,shippingAddressEquals|string',
            'shipping_city'                => 'required_unless:shipping-address-equals,shippingAddressEquals|string',
            'shipping_country'             => ['required_unless:shipping-_address-equals,shippingAddressEquals', new ValidCountryIso3()]
        ];
    }

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