链街Dcat后台
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

  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\Category;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Layout\Row;
  6. use Dcat\Admin\Layout\Content;
  7. use Dcat\Admin\Tree;
  8. use Dcat\Admin\Controllers\AdminController;
  9. class CategoryController extends AdminController
  10. {
  11. public function index(Content $content)
  12. {
  13. return $content->header('树状模型')
  14. ->body(function (Row $row) {
  15. $tree = new Tree(new Category);
  16. $row->column(12, $tree);
  17. });
  18. }
  19. public function form()
  20. {
  21. return Form::make(new Category(),function (Form $form){
  22. $form->text('title');
  23. $form->number('sort');
  24. // 只查一级
  25. $form->select('parent_id')->default(51);
  26. $form->image('cover_img');
  27. });
  28. }
  29. }