diff --git a/src/Group/Group.php b/src/Group/Group.php index 103dd4feae..bed5fd7dcf 100644 --- a/src/Group/Group.php +++ b/src/Group/Group.php @@ -126,4 +126,19 @@ public function permissions() { return $this->hasMany(Permission::class); } + + /** + * Check whether the group has a certain permission. + * + * @param string $permission + * @return bool + */ + public function hasPermission($permission) + { + if ($this->id == self::ADMINISTRATOR_ID) { + return true; + } + + return $this->permissions->contains('permission', $permission); + } }