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

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -