1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace App\Models; |
||
6 | |||
7 | use App\Events\User\Deleting; |
||
8 | use Illuminate\Database\Eloquent\Relations\HasMany; |
||
9 | use Illuminate\Foundation\Auth\User as Authenticatable; |
||
10 | use Illuminate\Notifications\Notifiable; |
||
11 | |||
12 | final class User extends Authenticatable |
||
13 | { |
||
14 | use Notifiable; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
15 | |||
16 | protected $fillable = [ |
||
17 | 'name', 'email', 'password', |
||
18 | ]; |
||
19 | |||
20 | protected $dispatchesEvents = [ |
||
21 | 'deleting' => Deleting::class, |
||
22 | ]; |
||
23 | |||
24 | private ?UserToken $currentToken = null; |
||
25 | |||
26 | 6 | public function tokens(): HasMany |
|
27 | { |
||
28 | 6 | return $this->hasMany(UserToken::class); |
|
29 | } |
||
30 | |||
31 | 2 | public function setCurrentToken(UserToken $token) |
|
32 | { |
||
33 | 2 | $this->currentToken = $token; |
|
34 | 2 | } |
|
35 | |||
36 | 1 | public function getCurrentToken() |
|
37 | { |
||
38 | 1 | return $this->currentToken; |
|
39 | } |
||
40 | |||
41 | 1 | public function getEmail(): string |
|
42 | { |
||
43 | 1 | return $this->getAttributeValue('email'); |
|
0 ignored issues
–
show
|
|||
44 | } |
||
45 | |||
46 | public function getName(): string |
||
47 | { |
||
48 | return $this->getAttributeValue('name'); |
||
0 ignored issues
–
show
|
|||
49 | } |
||
50 | } |
||
51 |