validation - Laravel 5 form request rules -
is there way in form request rules function can detect if delete method? because there should not same rules if patch method?
example:
public function rules() { if($method!='delete') { return [ 'title'=>'required', ]; } } thanks, andreas
use request method:
public function rules() { if(request()->ismethod('delete')) { return [ 'title'=>'required', ]; } }
Comments
Post a Comment