<?php

namespace App\Danoral\Entidades;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use App\Danoral\Entidades\Entidad;

class EUser extends Authenticatable
{
    use HasApiTokens;
    use Notifiable;
    use HasRoles;
    
    protected $table = 'admin.entidades_users';
    protected $primaryKey = 'idE';
    protected $keyType = 'bigint';
    public $incrementing = false;
    public $timestamps = true;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'idE',
        'email',
        'username',
        'password',
        'idU',
    ];

    public function UserView() { return $this->hasOne(UserView::class, 'idE', 'idE'); }

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    public function Entidad() {
        return $this->hasOne( Entidad::class );
    }

    


}
