-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid calling the config helper in the role/perm model constructor #2098
Conversation
Closes #2097
Could you test with facade \Config::get('auth.defaults.guard') , (Config.php)
|
@erikn69 I think it needs fixing too. I'll do it |
I tried. The facade doesn't work either |
#2097 (comment) class Kernel extends ConsoleKernel
{
public function __construct(
Application $app,
Dispatcher $events,
private \Spatie\Permission\Models\Role $role
){
parent::__construct($app,$events);
var_dump($role->toArray(), (new \Illuminate\Config\Repository())->get('auth'));
}
} From that i am getting php artisan cache:clear
array(1) {
["guard_name"]=> NULL # this is $role class
}
NULL # this is Config\Repository()
Application cache cleared! It seems that accessing I think that we can delete that line without problems, it seems to me that those lines are forgotten code from previous versions, it was replaced by laravel-permission/src/Models/Role.php Line 39 in 8a69aad
I did run test without those lines and everything works PHPUnit 9.5.20
Runtime: PHP 8.1.2
Configuration: /laravel-permission/phpunit.xml.dist
............................................................... 63 / 414 ( 15%)
............................................................... 126 / 414 ( 30%)
............................................................... 189 / 414 ( 45%)
............................................................... 252 / 414 ( 60%)
............................................................... 315 / 414 ( 76%)
............................................................... 378 / 414 ( 91%)
.................................... 414 / 414 (100%)
Time: 00:07.732, Memory: 48.00 MB
OK ( 414 tests, 928 assertions) |
@erikn69 I did. Could you take a look? |
Read again |
I'm sorry. I misunderstood. |
ok, I did |
Did |
@freekmurze ping |
Is it possible that this change is the cause of #2218? I've switched my app from using v5.5.9 to v5.5.10 and the latter now has the above issue, switching back to v5.5.9 resolves it. |
@JonPurvis yes, it was Try mi last PR |
I described the problem in #2097 with initializing the config.
I propose a solution.
Fixes #2097