<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $table = 'erc_usuarios';
    protected $fillable = [
        'email', 'password', 'enabled', 'rol_id',
    ];

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


    /*
    * Relaciones
    *
    *
    */
    public function rol()
    {
        return $this->belongsTo('App\Rol', 'rol_id', 'rol_id');
    }

    public function recibos()
    {
        return $this->hasMany('App\Recibo', 'usuario_id');
    }

    public function cuenta()
    {
        return $this->belongsTo('App\Cuenta', 'email', 'cuenta_cuenta');
    }
}
