<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Carbon\Carbon;
use Illuminate\Support\Facades\Storage;

class User extends \App\Models\AbstractModels\AbstractUser
{

  use HasApiTokens;
  use HasRoles;

  /** @use HasFactory<\Database\Factories\UserFactory> */
  use HasFactory;
  use HasProfilePhoto;
  use Notifiable;
  use TwoFactorAuthenticatable;

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

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