public function dataTable()
    {
        return (new EloquentDataTable($this->query()))
            ->editColumn('lft', '<i class="fa fa-dot-circle-o"></i>')
            ->addColumn('action', function (Category $category) {
                return view('administrator.categories.datatables.action', $category->toArray());
            })
            ->editColumn('authenticated', function (Category $category) {
                return view('administrator.categories.datatables.authenticated', $category->toArray());
            })
            ->addColumn('pub', function (Category $category) {
                return '<span class="badge bg-green">' . $category->countPublished() . '</span>';
            })
            ->addColumn('unpub', function (Category $category) {
                return '<span class="badge bg-yellow">' . $category->countUnpublished() . '</span>';
            })
            ->editColumn('hits', function (Category $category) {
                return '<span class="badge bg-blue">' . $category->hits . '</span>';
            })
            ->editColumn('title', function (Category $category) {
                return view('administrator.categories.datatables.title', compact('category'));
            })
            ->editColumn('created_at', function (Category $category) {
                return $category->created_at->format('Y-m-d');
            })
            ->rawColumns(['lft', 'published', 'authenticated', 'hits', 'title', 'action', 'pub', 'unpub']);
    }