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() { return [ 'name_ar' => 'required|string|min:3|max:191', 'name_en' => 'required|string|min:3|max:191', 'desc_ar' => 'required|string|min:3|max:191', 'desc_en' => 'required|string|min:3|max:191', 'icon' => 'nullable|image|mimes:jpg,jpeg,svg,png', 'category' => 'required|exists:categories,slug', 'lat' => 'required', 'long' => 'required', 'address' => 'required', 'commercial_id' => 'required', 'commercial_image' => 'nullable|image|mimes:jpg,jpeg,svg,png', 'bank_name' => 'required', 'iban_number' => 'required|numeric|digits:22', 'bank_number' => 'required|numeric|digits:10', 'name' => 'nullable', 'desc' => 'nullable', ]; } public function messages() { return [ 'bank_number.min' => 'يجب ان يكون طول حقل رقم الحساب البنكي علي الاقل 10 ارقام', ]; } public function prepareForValidation() { $this->merge([ 'name' => ['ar' => $this->name_ar, 'en' => $this->name_en], 'desc' => ['ar' => $this->desc_ar, 'en' => $this->desc_en], ]); } protected function failedValidation(Validator $validator) { throw new HttpResponseException($this->requestFailsReturn($validator)); } }
Back to File Manager