Skip to content

Commit

Permalink
Add comment to forModel scope
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed Dec 8, 2015
1 parent daa0f46 commit 054300a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Database/Ability.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public function scopeForModel($query, Model $model, $strict = false)
$query->orWhere('entity_id', $model->getKey());
}

// If the model does not exist, we want to search for blanket abilities
// that cover all instances of this model. If it does exist, we only
// want to find blanket abilities if we're not using strict mode.
if ( ! $model->exists || ! $strict) {
$query->whereNull('entity_id');
}
Expand Down

0 comments on commit 054300a

Please sign in to comment.