<?phpnamespaceOnestartup\ProductPrimerPlano\Requests;useIlluminate\Foundation\Http\FormRequest;classRequestCategoryextendsFormRequest{/** * Determine if the user is authorized to make this request. * * @return bool */publicfunctionauthorize(){returntrue;}/** * Get the validation rules that apply to the request. * * @return array */publicfunctionrules(){if($this->get("_method")=="PUT"||$this->get("_method")=="PATCH"){$slug='required|max:455|unique:product_categories,slug,'.$this->route("category");}else{$slug='required|max:455|unique:product_categories,slug';}return['name'=>'required|max:355','slug'=>$slug,'description'=>'max:455','active'=>'required|boolean','portada'=>'image'];}}