Skip to content

Commit

Permalink
Merge pull request #2225 from spatie/revert-2098-fix_config
Browse files Browse the repository at this point in the history
Revert "Avoid calling the config helper in the role/perm model constructor"
  • Loading branch information
drbyte authored Oct 21, 2022
2 parents c90f54b + 6a4747d commit 7ec0a46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Models/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Permission extends Model implements PermissionContract

public function __construct(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');

parent::__construct($attributes);

$this->guarded[] = $this->primaryKey;
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Role extends Model implements RoleContract

public function __construct(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');

parent::__construct($attributes);

$this->guarded[] = $this->primaryKey;
Expand Down

0 comments on commit 7ec0a46

Please sign in to comment.