if i put service provider into app.php
$app->register(Spatie\Permission\PermissionServiceProvider::class);
i get an error: A facade root has not been set.
in previous versions, this was not necessary
in the lumen it is not recommended to use of facades
how can this be avoided?
thanx!
Apologies. We should fix that!
In the meantime you could use version 2.25.0 of the package.
The latest, version 2.28.1 should work properly as well.
From version 2.28.1 I get the following error in Lumen 5.7.6
BindingResolutionException
Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Cache\CacheManager
To resolve this error I have to add the following to bootstrap/app.php
$app->alias('cache', \Illuminate\Cache\CacheManager::class);
I don't know if this is an issue with laravel/lumen-framework, illuminate/cache or spatie/laravel-permission
From version
2.28.1I get the following error in Lumen5.7.6BindingResolutionException Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Cache\CacheManagerTo resolve this error I have to add the following to
bootstrap/app.php$app->alias('cache', \Illuminate\Cache\CacheManager::class);I don't know if this is an issue with
laravel/lumen-framework,illuminate/cacheorspatie/laravel-permission
Thank you very much!!
apparently this does not apply to this package, but it would be nice if the authors will cover this point in the documentation (it describes how to integrate the package in lumen)
I think it might be a problem with this package now using \Illuminate\Cache\CacheManager in PermissionRegistrar::__construct() and type-hinting...
If I change it to the following, it stops the error
/**
* PermissionRegistrar constructor.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
*/
public function __construct(Gate $gate)
{
$this->gate = $gate;
$this->permissionClass = config('permission.models.permission');
$this->roleClass = config('permission.models.role');
$this->cacheManager = app('cache');
$this->initializeCache();
}
Most helpful comment
From version
2.28.1I get the following error in Lumen5.7.6To resolve this error I have to add the following to
bootstrap/app.phpI don't know if this is an issue with
laravel/lumen-framework,illuminate/cacheorspatie/laravel-permission