fastadmin别名关联表与js下划线冲突问题解决:with里的别名,不要用驼峰,用shippingtype
Posted on 2020-10-13 15:35 Showker 阅读(656) 评论(0) 编辑 收藏 举报https://ask.fastadmin.net/question/9555.html
{field: 'shippingtype.st_name', title: __('Type_id'),sortable: true,operate: 'LIKE %...%', placeholder: '关键字,模糊搜索',addClass:'selectpage',extend:'data-source="shippingtype" data-primary-key="st_id" data-show-field="st_name"',},
controller端
$with_biBao=[
'admin' => function ($query) {
$query->withField('id,username');
},
'shippingtype'=> function ($query) {
$query->withField('st_id,st_name');
},
];
$total = $this->model
->with($with_biBao)
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with($with_biBao)
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();