summaryrefslogtreecommitdiff
path: root/src/Guard.php
blob: 48f05e1cd5b654473610f888bc4eba0c462edf1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);
  }
}