filter(function ($fieldName) use ($attribute) { return $fieldName !== $attribute; })->implode(','); }; return [ 'firstname' => [$atLeast('firstname'), 'string', 'min:1', 'max:255'], 'lastname' => [$atLeast('lastname'), 'string', 'min:1', 'max:255'], 'email' => [$atLeast('email'), 'email:rfc,dns,spoof,filter', 'max:255'], 'password' => [ $atLeast('password'), 'max:255', Password::min(8) ->mixedCase() ->letters() ->numbers() ->symbols() ->uncompromised() ], 'birth_date' => [$atLeast('birth_date'), 'date_format:Y-m-d', 'max:255'], 'address' => [$atLeast('address'), 'required_with:address2', 'string', 'max:255'], 'address2' => ['sometimes', 'string', 'max:255'], 'phone' => [$atLeast('phone'), 'string', 'phone:' . ($this->currentCountry ? $this->currentCountry->iso : implode(',', Country::getValidIsoAplha2Codes())), 'max:255'], 'country' => [ $atLeast('country'), 'numeric', new EnumIsValidRule(Country::class), sprintf( 'in:%s', implode(',', Country::getValidCountries()) ) ], 'city' => [$atLeast('city'), 'string', 'min:2', 'max:255'], 'postcode' => [$atLeast('postcode'), 'string', 'postal_code:' . ($this->currentCountry ? $this->currentCountry->iso : implode(',', Country::getValidIsoAplha2Codes())), 'max:255'], 'opt_in' => [$atLeast('opt_in'), 'boolean'], ]; } }