1 | <?php |
||
2 | |||
3 | namespace App\Models; |
||
4 | |||
5 | use Illuminate\Contracts\Auth\MustVerifyEmail; |
||
6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
||
7 | use Illuminate\Foundation\Auth\User as Authenticatable; |
||
8 | use Illuminate\Notifications\Notifiable; |
||
9 | |||
10 | class User extends Authenticatable |
||
11 | { |
||
12 | use HasFactory, Notifiable; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
13 | |||
14 | /** |
||
15 | * The attributes that are not mass assignable. |
||
16 | * |
||
17 | * @var string[] |
||
18 | */ |
||
19 | protected $guarded = [ |
||
20 | 'id', |
||
21 | 'role', |
||
22 | 'status', |
||
23 | 'remember_token', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * The attributes that should be hidden for serialization. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $hidden = [ |
||
32 | 'password', |
||
33 | 'remember_token', |
||
34 | 'email_verified_at', |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * The attributes that should be cast. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $casts = [ |
||
43 | 'email_verified_at' => 'datetime', |
||
44 | ]; |
||
45 | |||
46 | // Relations |
||
47 | |||
48 | /** |
||
49 | * User can create multiple quizzes. |
||
50 | */ |
||
51 | public function quizzes() |
||
52 | { |
||
53 | return $this->hasMany(Quiz::class, 'author_id'); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * User can attempt multiple quizzes. |
||
58 | */ |
||
59 | public function attempts() |
||
60 | { |
||
61 | return $this->hasMany(Attempt::class); |
||
62 | } |
||
63 | } |
||
64 |