body($this->simpleGrid()); } return $content ->title($this->title()) ->description(trans('admin.list')) ->body($this->treeView()); } protected function simpleGrid() { $grid = new SimpleGrid(new Permission()); $grid->id->sortable(); $grid->slug; $grid->name; $grid->filter(function (Grid\Filter $filter) { $filter->like('slug'); $filter->like('name'); }); return $grid; } /** * @return \Dcat\Admin\Tree */ protected function treeView() { $model = config('admin.database.permissions_model'); $tree = new Tree(new $model()); $tree->disableCreateButton(); $tree->branch(function ($branch) { $payload = "
$path
";
})->implode(' ');
$method = collect($method ?: ['ANY'])->unique()->map(function ($name) {
return strtoupper($name);
})->map(function ($name) {
return "{$name}";
})->implode(' ').' ';
$payload .= " $method$path";
return $payload;
});
return $tree;
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
$show = new Show($id, new Permission());
$show->id;
$show->slug;
$show->name;
$show->http_path->unescape()->as(function ($path) {
return collect($path)->filter()->map(function ($path) {
$method = $this->http_method ?: ['ANY'];
if (Str::contains($path, ':')) {
[$method, $path] = explode(':', $path);
$method = explode(',', $method);
}
$method = collect($method)->map(function ($name) {
return strtoupper($name);
})->map(function ($name) {
return "{$name}";
})->implode(' ');
if (! empty(config('admin.route.prefix'))) {
$path = '/'.trim(config('admin.route.prefix'), '/').$path;
}
return "$path