Edit File: RegisterRequest.php
<?php namespace App\Http\Requests\Api\Provider\Auth; use App\Enums\ProductDeliveryTypesEnum; use App\Http\Requests\BaseRequest; use Illuminate\Validation\Rule; class RegisterRequest extends BaseRequest { public function rules() { return [ // General Information for Auth 'image' => 'required|image|mimes:jpeg,png,jpg,svg,webp|max:2048', 'name' => 'required|string|max:200', 'email' => [ 'required', 'email:rfc,dns', 'max:100', 'unique:providers,email,NULL,id,deleted_at,NULL' ], 'country_code' => 'required|numeric|digits_between:2,5', 'phone' => 'required|numeric|digits_between:9,10|unique:providers,phone,NULL,id,deleted_at,NULL', // StoreRequest Information 'identity_number' => ['required', 'numeric', 'digits_between:10,16', 'unique:providers,identity_number,NULL,id,deleted_at,NULL'], 'civil_registration_number' => ['required', 'numeric', 'digits_between:10,16', 'unique:providers,civil_registration_number,NULL,id,deleted_at,NULL'], 'tax_number' => ['required', 'numeric', 'digits_between:10,16', 'unique:providers,tax_number,NULL,id,deleted_at,NULL'], 'logo' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp|max:2048', 'whatsapp_country_code' => 'required|numeric|digits_between:2,5', 'whatsapp_phone' => 'required|numeric|digits_between:9,10|unique:providers,whatsapp_phone,NULL,id,deleted_at,NULL', 'store_name' => 'required|array|size:' . count(languages()), 'store_name.*' => 'required|max:200', 'store_description' => 'required|array|size:' . count(languages()), 'store_description.*' => 'required|max:500', 'category_id' => [ 'required', 'numeric', Rule::exists('categories', 'id')->whereNull('parent_id')->where('status', true) ], 'sub_categories' => 'required|array', 'sub_categories.*' => [ 'required', 'numeric', Rule::exists('categories', 'id') ->whereNotNull('parent_id')->where('parent_id', $this->category_id)->where('status', true) ], 'delivery_method' => 'required|numeric|in:' . implode(',', array_column(ProductDeliveryTypesEnum::cases(), 'value')), // Location Information 'city_id' => 'required|numeric|exists:cities,id', 'neighborhood_id' => 'required|numeric|exists:neighborhoods,id', 'lat' => 'required|numeric', 'lng' => 'required|numeric', 'map_desc' => 'nullable|string|max:255', 'preparing_time' => 'required|string|max:255', // bank account 'minimum_order' => 'required|numeric|min:1|max:100000', 'bank_name' => 'required|string|max:255', 'account_name' => 'required|string|max:255', 'account_number' => 'required|numeric|unique:bank_accounts,account_number|digits_between:10,20', 'iban' => ['required', 'string', 'regex:/(SA)[0-9]{22}/', 'unique:bank_accounts,iban'], 'bank_account_image' => 'nullable|file|mimes:jpeg,png,jpg,pdf|max:2048', // end bank account 'is_accept_terms' => ['required', 'in:1,true'], ]; } public function prepareForValidation(): void { $this->merge([ 'phone' => fixPhone($this->phone), 'country_code' => fixPhone($this->country_code), 'whatsapp_phone' => fixPhone($this->whatsapp_phone), 'whatsapp_country_code' => fixPhone($this->whatsapp_country_code), ]); } public function messages() { return [ 'iban.regex' => __('apis.iban_format'), ]; } }
Back to File Manager