Closed ChartWay closed 4 years ago
按照官方文档使用,但是提示 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'order clause' (SQL: select * fromareasorder byorder= 0,order)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'order clause' (SQL: select * from
order by
= 0,
)
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'); });
按照官方文档使用,但是提示
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'order clause' (SQL: select * from
areasorder by
order= 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'); });