From 14e4517bd49130d6119228107eb21ae47ae120ab Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 18 Oct 2024 15:15:12 +0200 Subject: [PATCH] Fix gate isset key (#1692) * Check if key is set * Use isset * Fix --- src/DataCollector/GateCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);