<?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 $fillable = [
        'name', 'email', 'password', 'role', 'surname','tel', 'idCard', 'address', 'img','estado'
    ];

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

    /**
     *Obtener una foto default en caso de que el usuario no tenga 
     */
    function getPicture(){
        $default = 'https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg';
        return (strlen($this->img)<5) ? $default : $this->img;
    }
}
