/** * Get the query object to be processed by datatables. * * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder */ public function query() { $users = Navigation::query(); return $this->applyScopes($users); }
/** * Publish/Unpublish a menu. * * @param \Yajra\CMS\Entities\Navigation $navigation * @param \Yajra\CMS\Entities\Menu $menu * @return \Illuminate\Http\JsonResponse */ public function publish(Navigation $navigation, Menu $menu) { /** @var \Yajra\CMS\Entities\Menu $menu */ $menu = $navigation->menus()->findOrFail($menu->id); $menu->togglePublishedState(); return $this->notifySuccess(sprintf('Menu successfully %s!', $menu->published ? 'published' : 'unpublished')); }
/** * Publish/Unpublish a navigation. * * @param \Yajra\CMS\Entities\Navigation $navigation * @return \Illuminate\Http\JsonResponse */ public function publish(Navigation $navigation) { $navigation->togglePublishedState(); return $this->notifySuccess(sprintf(trans('cms::navigation.update.publish'), $navigation->published ? 'published' : 'unpublished')); }