route('tender'); if (is_null($tender)) { // Determine if the user is authorized to access tender module, return $request->user('admin.web')->canDo('tender.tender.view'); } if ($request->isMethod('POST') || $request->is('*/create')) { // Determine if the user is authorized to create an entry, return $request->user('admin.web')->can('create', $tender); } if ($request->isMethod('PUT') || $request->isMethod('PATCH') || $request->is('*/edit')) { // Determine if the user is authorized to update an entry, return $request->user('admin.web')->can('update', $tender); } if ($request->isMethod('DELETE')) { // Determine if the user is authorized to delete an entry, return $request->user('admin.web')->can('destroy', $tender); } // Determine if the user is authorized to view the module. return $request->user('admin.web')->can('view', $tender); } /** * 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 [ ]; } if ($request->isMethod('PUT') || $request->isMethod('PATCH')) { // Validation rule for update request. return [ ]; } // Default validation rule. return [ ]; } }