route('catalogo'); if (is_null($catalogo)) { // Determine if the user is authorized to access catalogo module, return $request->user('web')->canDo('catalogo.catalogo.view'); } if ($request->isMethod('POST') || $request->is('*/create')) { // Determine if the user is authorized to create an entry, return $request->user('web')->can('create', $catalogo); } if ($request->isMethod('PUT') || $request->isMethod('PATCH') || $request->is('*/edit')) { // Determine if the user is authorized to update an entry, return $request->user('web')->can('update', $catalogo); } if ($request->isMethod('DELETE')) { // Determine if the user is authorized to delete an entry, return $request->user('web')->can('delete', $catalogo); } // Determine if the user is authorized to view the module. return $request->user('web')->can('view', $catalogo); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(Request $request) { if ($request->isMethod('POST')) { // validation rule for create request. return [ 'codigo' => 'required', 'nombre' => 'required', ]; } if ($request->isMethod('PUT') || $request->isMethod('PATCH')) { // Validation rule for update request. return [ 'codigo' => 'required', 'nombre' => 'required', ]; } // Default validation rule. return [ ]; } }