SmallRuralDog / laravel-vue-admin

开箱即用的Laravel后台扩展,前后端分离,后端控制前端组件,无需编写vue即可创建一个vue+vuex+vue-route+elment-ui+laravel的项目 ,丰富的表单 表格组件,强大的自定义组件功能。
https://www.yuque.com/smallruraldog/laravel-vue-admin/overview
MIT License
413 stars 73 forks source link

Cascader报错 #18

Closed ChartWay closed 4 years ago

ChartWay commented 4 years ago

按照官方文档使用,但是提示 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'order clause' (SQL: select * fromareasorder byorder= 0,order)

Area模型

`<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model; use SmallRuralDog\Admin\Traits\ModelTree;

class Area extends Model { use ModelTree; public function children() { return $this->hasMany(get_class($this), 'parent_id')->orderBy('id'); } }`

User控制器表单

$form->item('areas', '所在地')->displayComponent(function () { $areas = new Area(); $allNodes = $areas->toTree(); return Cascader::make()->options($allNodes)->value('id')->label('name')->expandTrigger('hover'); });