1 | <?php |
||
8 | class Invite extends Model |
||
9 | { |
||
10 | protected $dates = [ 'valid_until' ]; |
||
11 | |||
12 | public function __construct(array $attributes = [ ]) |
||
17 | |||
18 | /** |
||
19 | * Has the invite expired. |
||
20 | * |
||
21 | * @return bool |
||
22 | */ |
||
23 | public function hasExpired() |
||
29 | |||
30 | /** |
||
31 | * Is the invite full. |
||
32 | * |
||
33 | * @return bool |
||
34 | */ |
||
35 | public function isFull() |
||
41 | |||
42 | /** |
||
43 | * Is the invite restricted to a user. |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function isRestricted() |
||
51 | |||
52 | |||
53 | /** |
||
54 | * Is the invite restricted for a particular user. |
||
55 | * |
||
56 | * @param string $email |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function isRestrictedFor($email) |
||
64 | |||
65 | /** |
||
66 | * Can the invite be used anymore. |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function isUseless() |
||
74 | |||
75 | /** |
||
76 | * Scope a query to only include expired invites. |
||
77 | * |
||
78 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
79 | * @return \Illuminate\Database\Eloquent\Builder |
||
80 | */ |
||
81 | public function scopeExpired($query) |
||
85 | |||
86 | /** |
||
87 | * Scope a query to only include full invites. |
||
88 | * |
||
89 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
90 | * @return \Illuminate\Database\Eloquent\Builder |
||
91 | */ |
||
92 | public function scopeFull($query) |
||
96 | |||
97 | /** |
||
98 | * Scope a query to only include useless invites. |
||
99 | * |
||
100 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
101 | * @return \Illuminate\Database\Eloquent\Builder |
||
102 | */ |
||
103 | public function scopeUseless($query) |
||
114 | } |
||
115 |