public function publish(Category $category)
    {
        $category->togglePublishedState();

        $category->getDescendants()->each(
            function (Category $cat) use ($category) {
                $cat->published = $category->published;
                $cat->save();
            }
        );

        $message = $category->published ? trans('cms::categories.publish.success') : trans('cms::categories.publish.error');

        return $this->notifySuccess($message);
    }
public function publish(Category $category)
    {
        $category->togglePublishedState();

        $category->getDescendants()->each(
            function (Category $cat) use ($category) {
                $cat->published = $category->published;
                $cat->save();
            }
        );

        $message = $category->published ? trans('cms::categories.publish.success') : trans('cms::categories.publish.error');

        return $this->notifySuccess($message);
    }
public function publish ( Category $ category ) { $ category -> togglePublishedState ( ) ; $ category -> getDescendants ( ) -> each ( function ( Category $ cat ) use ( $ category ) { $ cat -> published = $ category -> published ; $ cat -> save ( ) ; } ) ; $ message = $ category -> published ? trans ( 'cms::categories.publish.success' ) : trans ( 'cms::categories.publish.error' ) ; return $ this -> notifySuccess ( $ message ) ; }
Button Response from DataTable request to publish status.

@param  \Yajra\CMS\Entities\Category $category
@return \Illuminate\Http\JsonResponse
Button Response from DataTable request to publish status .