You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
820 B
34 lines
820 B
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Models\Category;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Layout\Row;
|
|
use Dcat\Admin\Layout\Content;
|
|
use Dcat\Admin\Tree;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
|
|
class CategoryController extends AdminController
|
|
{
|
|
public function index(Content $content)
|
|
{
|
|
return $content->header('树状模型')
|
|
->body(function (Row $row) {
|
|
$tree = new Tree(new Category);
|
|
|
|
$row->column(12, $tree);
|
|
});
|
|
}
|
|
|
|
public function form()
|
|
{
|
|
return Form::make(new Category(),function (Form $form){
|
|
$form->text('title');
|
|
$form->number('sort');
|
|
// 只查一级
|
|
$form->select('parent_id')->default(51);
|
|
$form->image('cover_img');
|
|
});
|
|
}
|
|
}
|