Edit File: updateOfferRequest.php
<?php namespace App\Http\Requests\Admin\Stores; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; class updateOfferRequest extends FormRequest { /** * 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() { if ($this->offer == null) { return [ ]; }else{ if ($this->offer_type == 'percentage') { return [ 'offer' => 'required' , 'offer_image' => 'required|image' , 'offer_amount' => 'required|numeric|max:100' , 'offer_type' => 'required|in:percentage,static_price', 'offer_max' => 'required|numeric', ]; }else{ return [ 'offer' => 'required' , 'offer_amount' => 'required|numeric' , 'offer_image' => 'required|image' , 'offer_type' => 'required|in:percentage,static_price', // 'offer_max' => 'required|numeric', ]; } } } public function messages(){ return [ 'offer_image.required' => trans('auth.off_img_req'), ]; } }
Back to File Manager