Edit File: UpdateProductsRequest.php
<?php namespace App\Http\Requests\Api\StoreProduct; use Illuminate\Foundation\Http\FormRequest; use App\Traits\Responses; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\Request; use App\Traits\ApiTrait; class UpdateProductsRequest 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 [ 'product_id'=>'required', 'name_ar' => 'required|string|min:3|max:191', 'name_en' => 'required|string|min:3|max:191', 'image' => 'nullable', // 'price' => 'required|numeric', 'discount' => 'nullable|numeric|lt:100', 'type' => 'multiple', 'store_menu_category_id' => 'required', 'desc_ar' => 'nullable|string|min:3|max:191', 'desc_en' => 'nullable|string|min:3|max:191', 'addition' => 'nullable', ]; } public function messages(){ return [ 'discount_from.after' => 'يجب علي حقل الخصم من ان يكون تاريخا لاحقا للأمس', 'desc_ar.required' => 'حقل الوصف بالعربي مطلوب', 'desc_en.required' => 'حقل الوصف بالانجليزي مطلوب', ]; } protected function failedValidation(Validator $validator) { throw new HttpResponseException($this->requestFailsReturn($validator)); } }
Back to File Manager