smuzi-ua /
dumka-backend
| 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
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 |