Edit File: UpdateStoreRequest.php
<?php namespace App\Http\Requests\Api\Profile; use App\Traits\ApiTrait; use Illuminate\Contracts\Validation\Validator; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\Request; class UpdateStoreRequest extends FormRequest { use ApiTrait; /** * 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() { $user = Auth('api')->user(); $store = $user->store; return [ 'name_ar' => 'nullable|string|min:3|max:191', 'name_en' => 'nullable|string|min:3|max:191', 'icon' => 'nullable|image|mimes:jpg,jpeg,svg,png', 'cover' => 'nullable|image|mimes:jpg,jpeg,svg,png', 'category' => 'nullable', 'lat' => 'nullable', 'long' => 'nullable', 'address' => 'nullable', 'commercial_id' => ['nullable' ], // 'unique:stores,commercial_id,'.$store->id], 'commercial_image' => 'image|mimes:jpg,jpeg,svg,png', 'bank_name' => 'nullable', 'iban_number' => 'nullable|min:10|unique:stores,iban_number,'.$store->id.',id,deleted_at,NULL', 'bank_number' => 'nullable|min:10|unique:stores,bank_number,'.$store->id.',id,deleted_at,NULL', 'days' => 'nullable', ]; } public function messages(){ return [ 'bank_number.min' => 'يجب ان يكون طول حقل رقم الحساب البنكي علي الاقل 10 ارقام', ]; } public function prepareForValidation() { if ($this->lng && !$this->long){ $this->merge([ 'long' => $this->lng, ]); } } protected function failedValidation(Validator $validator) { throw new HttpResponseException($this->requestFailsReturn($validator)); } }
Back to File Manager