User   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A verify() 0 6 1
A school() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Factories\HasFactory;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
use Illuminate\Notifications\Notifiable;
8
use Laravel\Sanctum\HasApiTokens;
9
10
final class User extends Authenticatable
11
{
12
    use HasApiTokens, HasFactory, Notifiable;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Notifications\Notifiable requires the property $email which is not provided by App\Models\User.
Loading history...
13
14
    protected $guarded = [];
15
16
    /**
17
     * The attributes that should be cast to native types.
18
     *
19
     * @var array
20
     */
21
    protected $casts = [
22
        'verified_at' => 'datetime',
23
    ];
24
25
    public function school()
26
    {
27
        return $this->belongsTo(School::class);
28
    }
29
30
    public function verify(): self
31
    {
32
        $this->verified_at = now();
33
        $this->save();
34
35
        return $this;
36
    }
37
}
38