/** * Add section to the menu ViewComposer file. * * @param dynamic * * @return bool */ public function addToMenu() { $plural = str_plural($this->class); $lower = '$' . strtolower($plural); return parent::addToMenu("// Section: {$plural}", "{$lower} = new Flat(_('{$plural}'));", sprintf("if(\$user->hasPermission(%d))", $this->permission), sprintf("\t{$lower}->addChild(new Link(route('admin.%s.index'), _('Index')));", $this->route), sprintf("if(\$user->hasPermission(%d))", $this->permission + 1), sprintf("\t{$lower}->addChild(new Link(route('admin.%s.create'), _('Add')));", $this->route)); }
/** * Add section to the menu ViewComposer file. * * @param dynamic * * @return bool */ public function addToMenu() { $content = sprintf("\$%s = (\$user->hasPermission(%d)) ? new Link(route('report.%s'), _('%s %s %s')) : new Node();", camel_case(str_replace('.', '_', $this->class)), $this->permission, $this->route, $this->class, $this->sufix, 'TO' + 'DO'); return parent::addToMenu($content); }