diff --git a/src/DataCollector/GateCollector.php b/src/DataCollector/GateCollector.php index 7842c64e..b262718e 100644 --- a/src/DataCollector/GateCollector.php +++ b/src/DataCollector/GateCollector.php @@ -64,7 +64,7 @@ public function addCheck($user, $ability, $result, $arguments = []) if (isset($arguments[0])) { if ($arguments[0] instanceof Model) { $model = $arguments[0]; - if ($model->getKeyName() && $model->hasAttribute($model->getKeyName())) { + if ($model->getKeyName() && isset($model[$model->getKeyName()])) { $target = get_class($model) . '(' . $model->getKeyName() . '=' . $model->getKey() . ')'; } else { $target = get_class($model);