Bristol SU Support Package
UserFilter.php
Go to the documentation of this file.
1 <?php
2 
3 
5 
6 use \BristolSU\ControlDB\Contracts\Models\User;
7 
11 abstract class UserFilter extends Filter
12 {
13 
19  private $user;
20 
29  public function setModel($model)
30  {
31  if (!($model instanceof User)) {
32  throw new \Exception(
33  sprintf('Cannot pass a class of type [%s] to a user filter', get_class($model))
34  );
35  }
36  $this->user = $model;
37  }
38 
44  public function hasModel(): bool
45  {
46  return $this->user !== null;
47  }
48 
54  public function model()
55  {
56  return $this->user;
57  }
58 
64  public function user()
65  {
66  return $this->model();
67  }
68 
69 
70 }