Это моя функция настройки
$this->crud->setModel('App\Models\OrderDetail');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/orderdetail');
$this->crud->setEntityNameStrings('product', 'products');
setPermissions('order-detail', $this->crud);
if(backpack_user()->hasRole('Merchant')){
$this->crud->addClause('join','orders', function($query){
$query->on('order_details.order_id', '=', 'orders.id')
->where('user_id', backpack_user()->id);
});
}
$this->crud->denyAccess(['create', 'update', 'show']);
$this->crud->orderBy('order_details.id','DESC');
SQL ошибка на консоли
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous (SQL: select * from `order_details` inner join `orders` on `order_details`.`order_id` = `orders`.`id` and `user_id` = 4 where `status` = on-delivery order by `order_details`.`id` desc, `id` desc limit 10)
Нет условия по пункту, работающему на Global Scope модели