|  | @@ 85-96 (lines=12) @@ | 
                                                            
                                    | 82 |  |      * | 
                                                            
                                    | 83 |  |      * @return \Spatie\Permission\Contracts\Permission | 
                                                            
                                    | 84 |  |      */ | 
                                                            
                                    | 85 |  |     public static function findByName(string $name, $guardName = null): PermissionContract | 
                                                            
                                    | 86 |  |     { | 
                                                            
                                    | 87 |  |         $guardName = $guardName ?? Guard::getDefaultName(static::class); | 
                                                            
                                    | 88 |  |  | 
                                                            
                                    | 89 |  |         $permission = static::findByNameOrId($name, $guardName); | 
                                                            
                                    | 90 |  |  | 
                                                            
                                    | 91 |  |         if (! $permission) { | 
                                                            
                                    | 92 |  |             throw PermissionDoesNotExist::create($name, $guardName); | 
                                                            
                                    | 93 |  |         } | 
                                                            
                                    | 94 |  |  | 
                                                            
                                    | 95 |  |         return $permission; | 
                                                            
                                    | 96 |  |     } | 
                                                            
                                    | 97 |  |  | 
                                                            
                                    | 98 |  |     /** | 
                                                            
                                    | 99 |  |      * Find a permission by its id (and optionally guardName). | 
                                                                                
                                |  | @@ 108-119 (lines=12) @@ | 
                                                            
                                    | 105 |  |      * | 
                                                            
                                    | 106 |  |      * @return \Spatie\Permission\Contracts\Permission | 
                                                            
                                    | 107 |  |      */ | 
                                                            
                                    | 108 |  |     public static function findById(int $id, $guardName = null): PermissionContract | 
                                                            
                                    | 109 |  |     { | 
                                                            
                                    | 110 |  |         $guardName = $guardName ?? Guard::getDefaultName(static::class); | 
                                                            
                                    | 111 |  |  | 
                                                            
                                    | 112 |  |         $permission = static::findByNameOrId($id, $guardName); | 
                                                            
                                    | 113 |  |  | 
                                                            
                                    | 114 |  |         if (! $permission) { | 
                                                            
                                    | 115 |  |             throw PermissionDoesNotExist::withId($id, $guardName); | 
                                                            
                                    | 116 |  |         } | 
                                                            
                                    | 117 |  |  | 
                                                            
                                    | 118 |  |         return $permission; | 
                                                            
                                    | 119 |  |     } | 
                                                            
                                    | 120 |  |  | 
                                                            
                                    | 121 |  |     /** | 
                                                            
                                    | 122 |  |      * Find or create permission by its name (and optionally guardName). |