Skip to content

Commit 6a4747d

Browse files
authored
Revert "Avoid calling the config helper in the role/perm model constructor"
1 parent c90f54b commit 6a4747d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Models/Permission.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Permission extends Model implements PermissionContract
2222

2323
public function __construct(array $attributes = [])
2424
{
25+
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');
26+
2527
parent::__construct($attributes);
2628

2729
$this->guarded[] = $this->primaryKey;

src/Models/Role.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Role extends Model implements RoleContract
2222

2323
public function __construct(array $attributes = [])
2424
{
25+
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');
26+
2527
parent::__construct($attributes);
2628

2729
$this->guarded[] = $this->primaryKey;

0 commit comments

Comments
 (0)