Completed
Push — master ( 5afcda...69d749 )
by Arjay
12:59
created

HasRoleAndPermission::grantPermissionBySlug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Yajra\Acl\Traits;
4
5
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
6
use Yajra\Acl\Models\Permission;
7
8
trait HasRoleAndPermission
9
{
10
    use HasRole {
11
        HasRole::getPermissions as getRolePermissions;
12
    }
13
14
    use InteractsWithPermission;
15
16
    /**
17
     * Get all user permissions slug.
18
     *
19
     * @return array|null
20
     */
21
    public function getPermissions(): array
22
    {
23
        $rolePermissions = $this->getRolePermissions();
0 ignored issues
show
Bug introduced by
The method getRolePermissions() does not exist on Yajra\Acl\Traits\HasRoleAndPermission. Did you maybe mean permissions()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24
        $userPermissions = $this->permissions->pluck('slug')->toArray();
25
26
        return collect($userPermissions)->merge($rolePermissions)->unique()->toArray();
27
    }
28
}
29