check() and Gate::check('submitProof', $this->route('participation')); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $countryCode = $this->integer('country') != 0 ? $this->integer('country') : ($authUser ? (new CrmRepository())->fetchCrmCustomer($authUser)->country->value : 0); $countryRules = match ($countryCode) { Country::belgium->value => [ 'phone' => 'phone:BE', ], Country::luxembourg->value => [ 'phone' => 'phone:LU', ], Country::germany->value => [ 'phone' => 'phone:DE', ], default => [ 'phone' => 'phone:FR', ] }; return \array_merge(Arr::only( parent::rules(), [ 'lastname', 'firstname', 'address', 'address2', 'postal_code', 'city', 'country' ] ), [ 'phone' => [ 'required', 'max:255', $countryRules['phone'], ], // * Min 10 KB, Max 2MB 'sticker' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048', 'ticket' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048', 'barcode' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048', ]); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return \array_merge( parent::attributes(), [ 'sticker' => trans('validation.custom.sticker'), 'ticket' => trans('validation.custom.ticket'), 'barcode' => trans('validation.custom.barcode'), ] ); } }