allowSimpleMode() ? 'simple-grid' : null; return <<{$this->prepare($this->grid())->render()} HTML; } /** * 是否启用简化模式. * * @param bool $value * * @return $this */ public function simple(bool $value = true) { return $this->payload(['_simple_' => $value]); } /** * @param Grid $grid * * @return Grid */ protected function prepare(Grid $grid) { if (! $grid->getName()) { $grid->setName($this->getDefaultName()); } if ($this->allowSimpleMode()) { $grid->disableCreateButton(); $grid->disablePerPages(); $grid->disableBatchDelete(); $grid->disableRefreshButton(); $grid->filter() ->panel() ->view('admin::filter.tile-container'); $grid->rowSelector()->click(); } return $grid; } /** * 判断是否启用简化模式. * * @return bool */ public function allowSimpleMode() { return $this->simple || $this->_simple_; } /** * 获取默认名称. * * @return string */ protected function getDefaultName() { return strtolower(str_replace('\\', '-', static::class)); } }