Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Entities/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Permission extends \Spatie\Permission\Models\Permission
/**
* @var array
*/
protected $fillable = ['name', 'uuid'];
protected $fillable = ['name', 'uuid', 'guard_name'];
}
2 changes: 1 addition & 1 deletion app/Entities/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class Role extends \Spatie\Permission\Models\Role
/**
* @var array
*/
protected $fillable = ['name', 'uuid'];
protected $fillable = ['name', 'uuid', 'guard_name'];
}
9 changes: 5 additions & 4 deletions app/Support/HasPermissionsUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace App\Support;

use App\Entities\Permission;
use Spatie\Permission\Contracts\Permission;
use App\Entities\Permission as PermissionEntity;

/**
* Class HasPermissionsUuid.
Expand All @@ -16,14 +17,14 @@ trait HasPermissionsUuid
*
* @return Permission
*/
protected function getStoredPermission($permissions)
protected function getStoredPermission($permissions): Permission
{
if (is_string($permissions)) {
return app(Permission::class)->where('name', $permissions)->orWhere('uuid', $permissions)->first();
return app(PermissionEntity::class)->where('name', $permissions)->orWhere('uuid', $permissions)->first();
}

if (is_array($permissions)) {
return app(Permission::class)->whereIn('name', $permissions)->orWhereIn('uuid', $permissions)->get();
return app(PermissionEntity::class)->whereIn('name', $permissions)->orWhereIn('uuid', $permissions)->get();
}

return $permissions;
Expand Down
7 changes: 4 additions & 3 deletions app/Support/HasRolesUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace App\Support;

use App\Entities\Role;
use App\Entities\Role as RoleEntity;
use Spatie\Permission\Contracts\Role;

trait HasRolesUuid
{
Expand All @@ -11,10 +12,10 @@ trait HasRolesUuid
*
* @return Role
*/
protected function getStoredRole($role)
protected function getStoredRole($role): Role
{
if (is_string($role)) {
return app(Role::class)->where('name', $role)->orWhere('uuid', $role)->first();
return app(RoleEntity::class)->where('name', $role)->orWhere('uuid', $role)->first();
}

return $role;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
],
"require": {
"php": ">=7.0.0",
"dingo/api": "1.0.*@dev",
"laravel/framework": "5.4.*",
"laravel/passport": "^3.0",
"laravel/tinker": "~1.0",
"predis/predis": "^1.1",
"dingo/api": "1.0.*@dev",
"spatie/laravel-permission": "^1.7",
"spatie/laravel-permission": "^2.4",
"webpatser/laravel-uuid": "^2.0"
},
"require-dev": {
Expand Down
Loading