1 | <?php namespace App\Traits\Users; |
||
7 | trait Activates |
||
8 | { |
||
9 | /** |
||
10 | * @param \App\Models\User $user |
||
11 | * |
||
12 | * @return \App\Models\UserActivation |
||
13 | */ |
||
14 | 1 | protected function create(User $user) |
|
24 | |||
25 | /** |
||
26 | * @param \App\Models\User $user |
||
27 | * @param string|null $code |
||
28 | * |
||
29 | * @return bool |
||
30 | */ |
||
31 | 2 | protected function exists(User $user, $code = null) |
|
41 | |||
42 | /** |
||
43 | * Returns the expiration date. |
||
44 | * |
||
45 | * @return \Carbon\Carbon |
||
46 | */ |
||
47 | 3 | protected function expires() |
|
53 | |||
54 | /** |
||
55 | * @param \App\Models\User $user |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | 2 | protected function completed(User $user) |
|
65 | |||
66 | /** |
||
67 | * @param \App\Models\User $user |
||
68 | * @param string $code |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | 1 | public function complete(User $user, $code) |
|
87 | |||
88 | /** |
||
89 | * Return a random string for an activation code. |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 1 | protected function generateActivationCode() |
|
97 | |||
98 | /** |
||
99 | * Get the e-mail subject line to be used for the reset link email. |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | 2 | protected function getActivationEmailSubject() |
|
107 | } |
||
108 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: