Skip to content

Commit

Permalink
Fix call to an undefined method Role::getRoleClass
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed Apr 26, 2023
1 parent a2ad839 commit 41bb5a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
parameters:
ignoreErrors:
-
# PHPStan can't understand what's going on in context of Role class using Builder `when`
message: "#^Call to an undefined method Spatie\\\\Permission\\\\Models\\\\Role::getRoleClass\\(\\).$#"
count: 1
path: src\Traits\HasPermissions.php
5 changes: 5 additions & 0 deletions src/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function __construct(array $attributes = [])
$this->table = config('permission.table_names.roles') ?: parent::getTable();
}

public function getRoleClass(): string
{
return static::class;
}

public static function create(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? Guard::getDefaultName(static::class);
Expand Down

0 comments on commit 41bb5a1

Please sign in to comment.