protected function beforeTable()
    {
        $hasMassActions = $this->hasMassActions();
        $filters        = $this->filterAdapter->getFilters();

        $hasColumnFilter = $this->hasColumnFilter();
        $params          = [];
        if (!$hasMassActions and ! $this->searchable and empty($this->selects) and ! $filters and ! $hasColumnFilter) {
            return '';
        }


        if (!empty($this->selects)) {
            array_set($params, 'selects', implode('', $this->selects));
        }
        array_set($params, 'searchable', $this->searchable);
        if ($this->searchable) {
            $value = (($value = $this->getGlobalSearchValue()) !== false) ? $value : '';
            array_set($params, 'search', $value);
        }
        $result = event(strtolower(class_basename($this->datatable)) . '.datatables.top.center', [&$return]);
        if (isset($result[0])) {
            array_set($params, 'datatables_top_center', $result[0]);
        }

        if (!is_null($this->rightCtrls)) {
            array_set($params, 'rightCtrls', $this->rightCtrls);
        }

        if (empty($filters) and ! is_null($this->datatable)) {
            $list = $this->datatable->getFilters();
            foreach ($list as $filter) {
                $this->filterAdapter->add($filter);
            }
            $filters = $this->filterAdapter->getFilters();
        }

        if ($hasColumnFilter) {
            array_set($params, 'columnFilter', $this->getColumnFilterAdapter());
        }
        if ($filters) {
            array_set($params, 'filters', $filters);
        }

        if ($hasMassActions) {
            array_set($params, 'massActions', $this->massActions);
        }
        return view('datatables-helpers::before', $params)->render();
    }