Edit File: Store.php
<?php namespace App\Http\Requests\Admin\Ad; use Illuminate\Foundation\Http\FormRequest; class Store 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->getMethod() === 'PUT') { return [ 'cover' => 'nullable' , 'expiry_date' => 'required|date|after:today' , ]; }else{ return [ 'cover' => 'required' , 'expiry_date' => 'required|date|after:today' , ]; } } public function messages() { return [ 'expiry_date.after' => 'يجب تاريخ الصلاحيه ان يكون لاحقا لليوم' ]; } }
Back to File Manager