Edit File: UpdateProfileRequest.php
<?php namespace App\Http\Requests\Api\Delegate\Profile; use App\Http\Requests\Api\BaseApiRequest; use Illuminate\Validation\Rule; class UpdateProfileRequest extends BaseApiRequest { public function rules() { $bankId = auth()->user()->bankAccount?->id; return [ 'name' => 'required|max:50', 'image' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048', 'email' => ['nullable', 'email:rfc,dns', Rule::unique('delegates', 'email')->whereNull('deleted_at')->ignore(auth()->id())], 'lat' => 'required|numeric', 'lng' => 'required|numeric', 'map_desc' => 'required|string', 'city_id' => 'required|exists:cities,id', 'car_plat_number' => 'required|string|max:50', 'car_images' => 'nullable|array|size:2', 'car_images.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048', 'identity_images' => 'nullable|array|size:2', 'identity_images.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048', 'licencses_certificate' => 'nullable|array|size:2', 'licencses_certificate.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048', 'neighborhoods' => 'required|array', 'neighborhoods.*' => 'required|numeric|exists:neighborhoods,id', // bank account 'account_name' => 'nullable|string|max:255', 'bank_name' => 'required|string|max:255', 'account_number' => ['required', 'numeric', Rule::unique('bank_accounts', 'account_number')->ignore($bankId), 'digits_between:10,20'], 'iban' => ['required', 'string', 'regex:/(SA)[0-9]{22}/', Rule::unique('bank_accounts', 'iban')->ignore($bankId)], ]; } public function prepareForValidation() { $neighborhoods = is_string($this->neighborhoods) ? json_decode($this->neighborhoods, true) : $this->neighborhoods; $this->merge([ 'neighborhoods' => $neighborhoods ]); } }
Back to File Manager