如果我使用 toSql() 转储查询的 sql,我会得到:
select * from `permissions` inner join `vendor_permissions` on `permissions`.`id` = `vendor_permissions`.`permission_id` where `vendor_permissions`.`vendor_id` = ?
但是发送到我的数据库的实际查询是这样的:
select `permissions`.*, `vendor_permissions`.`vendor_id` as `pivot_vendor_id`, `vendor_permissions`.`permission_id` as `pivot_permission_id` from `permissions` inner join `vendor_permissions` on `permissions`.`id` = `vendor_permissions`.`permission_id` where `vendor_permissions`.`vendor_id` = ?
如您所见,它们有很大的不同。为什么是这样?我正在尝试清除关系的查询缓存,为此我需要能够获取正在使用的实际查询,那么我该怎么做呢?