Skip to content

Commit

Permalink
Fix gate isset key (#1692)
Browse files Browse the repository at this point in the history
* Check if key is set

* Use isset

* Fix
  • Loading branch information
barryvdh authored Oct 18, 2024
1 parent a4e6909 commit 14e4517
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DataCollector/GateCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 14e4517

Please sign in to comment.