diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-12-02 14:14:34 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-12-02 14:14:34 +0100 |
commit | e5a243a52b910e35b10b26c06aa8978356b86769 (patch) | |
tree | 74ddb82add2f3ea200e9fd11cfedb6c0cace09be /src/Guard.php | |
parent | fa9096c0ab521aae45cab6c48a54290d14a221b9 (diff) |
login and events
Diffstat (limited to 'src/Guard.php')
-rw-r--r-- | src/Guard.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Guard.php b/src/Guard.php new file mode 100644 index 0000000..48f05e1 --- /dev/null +++ b/src/Guard.php @@ -0,0 +1,13 @@ +<?php + +namespace App; + +class Guard +{ + public static function ownsVillage(int $villageId): bool + { + $hasVillage = DB::query('select id from user_villages where user_id=:userId and village_id=:villageId', ['userId' => $_SESSION['user']['id'], 'villageId' => $villageId])->fetchColumn(); + + return ! empty($hasVillage); + } +} |