| @@ 20-30 (lines=11) @@ | ||
| 17 | *  | 
                                |
| 18 | * @param string|array $slug  | 
                                |
| 19 | */  | 
                                |
| 20 | public function grantPermissionBySlug($slug)  | 
                                |
| 21 |     { | 
                                |
| 22 | $this->getPermissionClass()  | 
                                |
| 23 | ->newQuery()  | 
                                |
| 24 |             ->whereIn('slug', (array) $slug) | 
                                |
| 25 |             ->each(function ($permission) { | 
                                |
| 26 | $this->permissions()->attach($permission);  | 
                                |
| 27 | });  | 
                                |
| 28 | ||
| 29 |         $this->load('permissions'); | 
                                |
| 30 | }  | 
                                |
| 31 | ||
| 32 | /**  | 
                                |
| 33 | * Get Permission class.  | 
                                |
| @@ 61-71 (lines=11) @@ | ||
| 58 | *  | 
                                |
| 59 | * @param string|array $resource  | 
                                |
| 60 | */  | 
                                |
| 61 | public function grantPermissionByResource($resource)  | 
                                |
| 62 |     { | 
                                |
| 63 | $this->getPermissionClass()  | 
                                |
| 64 | ->newQuery()  | 
                                |
| 65 |             ->whereIn('resource', (array) $resource) | 
                                |
| 66 |             ->each(function ($permission) { | 
                                |
| 67 | $this->permissions()->attach($permission);  | 
                                |
| 68 | });  | 
                                |
| 69 | ||
| 70 |         $this->load('permissions'); | 
                                |
| 71 | }  | 
                                |
| 72 | ||
| 73 | /**  | 
                                |
| 74 | * Assigns the given permission to the role.  | 
                                |