<?php
namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Notifications\Notifiable;
use Carbon\Carbon;
use Auth;
use Hash;

class User extends \App\Models\AbstractModels\AbstractUser
{
  use HasFactory, Notifiable, HasRoles;

  public function getFullNameAttribute(){
    return $this->nome." ".$this->cognome;
  }

  public function sendPasswordResetNotification($token)
  {
    $url = config('app.url').'/reset-password/'.$token;
    $this->notify(new \App\Notifications\ResetPasswordNotification($url));
  }

  // public function setPasswordAttribute($value){
  //   if($value == null){
  //     return;
  //   }else{
  //     $this->attributes['password'] = Hash::make($value);
  //   }
  // }
}
