-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Doesn't work with spatie / laravel-permission #99
Comments
I'm having the same issue. I hope they can answer this. packages versions:
|
Hi guys. As of now, there is no official support for this package. Will add it to the wish list, contributions are welcome. |
We have it working with these versions:
|
Can you re-test this please with the latest release (v5.1.2) please? Could be that it fixes this issue as well. |
Main resone behind his error is only that if any one found same issue with other packages ( like spatie/permission ) they must need to check models has in my case i have extended Permission, Role Models and add <?php
namespace App;
use Spatie\Permission\Models\Permission as SpatiePermission;
class Permission extends SpatiePermission
{
use \Spiritix\LadaCache\Database\LadaCacheTrait;
} <?php
namespace App;
use Spatie\Permission\Models\Role as SpatieRole;
class Role extends SpatieRole
{
use \Spiritix\LadaCache\Database\LadaCacheTrait;
} to pass my custom models to spatie/permission package i have change configration <?php
return [
'models' => [
'permission' => App\Permission::class,
'role' => App\Role::class,
], and It works Thanks @spiritix for wonderfull free code. hop that help to solve problem in upcomming version. |
@zgetro Thanks for providing a solution to this problem. I will reference it in the README, since similar workarounds can be used for other packages as well. Unfortunately, I don't think that issues with third-party libraries are generically solvable within Lada Cache. I'd have to look at every package in detail and develop a custom solution. |
I am using default setup of spatie / laravel-permission package and lada-cache packages. Everything works well except user<->roles relation.
class User extends Authenticatable
{
use HasRoles;
use LadaCacheTrait;
}
If i try to make request with 'roles' relation i'm getting an exception.
\App\User::whereHas('roles')->get();
TypeError
Argument 1 passed to Spiritix\LadaCache\Reflector::getTablesFromWhere() must be an instance of Spiritix\LadaCache\Database\QueryBuilder, instance of Illuminate\Database\Query\Builder given, called in /home/belgiets/projects/laravel7/vendor/spiritix/lada-cache/src/Spiritix/LadaCache/Reflector.php on line 145
Reproduced on clear installation of:
The text was updated successfully, but these errors were encountered: