Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
warrickbayman committed Jan 6, 2024
1 parent c038914 commit f75308c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DeadboltService.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function all(): array
/**
* Get the permission descriptions.
*
* @param array<string> $permissions
* @param array<string>|string $permissions
*/
public function describe(...$permissions): array
{
Expand Down
6 changes: 6 additions & 0 deletions src/Traits/HasPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace TPG\Deadbolt\Traits;

use Illuminate\Database\Eloquent\Builder;
use TPG\Deadbolt\Facades\Deadbolt;
use TPG\Deadbolt\User as DeadboltUser;

Expand All @@ -13,4 +14,9 @@ public function permissions(): DeadboltUser
{
return Deadbolt::user($this);
}

public function scopeWithPermissions(Builder $builder, ...$permissions): Builder
{
return $builder->whereJsonContains('permissions', $permissions);
}
}

0 comments on commit f75308c

Please sign in to comment.