久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      Laravel admin 實(shí)現(xiàn)分類樹/模型樹

      Laravel admin 實(shí)現(xiàn)分類樹/模型樹

      修改模型Category.php

      <?php  namespace AppAdminModels;  use EncoreAdminTraitsAdminBuilder; use EncoreAdminTraitsModelTree; use IlluminateDatabaseEloquentModel;  class Category extends Model {  use ModelTree, AdminBuilder;   protected $table = 'category';   public function __construct(array $attributes = [])  {   parent::__construct($attributes); 		//這里根據(jù)自己的字段修改   $this->setParentColumn('parent_id');   $this->setOrderColumn('sort');   $this->setTitleColumn('name');  }  }

      修改控制文件CategoryController.php

      <?php  namespace AppAdminControllers;  use AppAdminModelsCategory; use EncoreAdminControllersAdminController; use EncoreAdminFacadesAdmin; use EncoreAdminLayoutContent; use EncoreAdminShow;  class CategoryController extends AdminController {  /**   * Title for current resource.   *   * @var string   */  protected $title = '商品分類管理';   public function index(Content $content)  {   return Admin::content(function ($content) {    $content->header('商品分類管理');    $content->body(Category::tree(function ($tree) {     $tree->branch(function ($branch) {      $src = config('admin.upload.host') . '/' . $branch['image'];      $logo = "<img src='$src' style='max-width:30px;max-height:30px' class='img'/>";       return "{$branch['id']} - {$branch['name']} $logo";     });    }));   });  } 	//下面是自己的代碼 	//.......  }

      添加路由app/Admin/routes.php

      $router->resource('categories',CategoryController::class);

      select中使用分類樹

      $form->select('parent_id', __('Parent id'))->options(Category::selectOptions())->default(1);

      總結(jié)

      到此這篇關(guān)于laravel admin實(shí)現(xiàn)分類樹/模型樹的示例代碼的文章就介紹到這了,

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)