89 lines
2.0 KiB
PHP
89 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
'cedula',
|
|
'estado',
|
|
'img_perfil',
|
|
'rol_id'
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for serialization.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'email_verified_at' => 'datetime',
|
|
];
|
|
|
|
public function rol(){
|
|
return $this ->belongsTo(Role::class);
|
|
}
|
|
|
|
public function saldo(){
|
|
return $this ->hasOne(Saldo::class,'usuario_id');
|
|
}
|
|
|
|
public function modificaciones(){
|
|
return $this ->hasOne(Configuracione::class,'usermodifico_id');
|
|
}
|
|
|
|
public function permisos(){
|
|
return $this ->hasMany(Permiso::class,'usuario_id');
|
|
}
|
|
|
|
public function preferenciales(){
|
|
return $this ->hasMany(Preferencial::class,'usuario_id');
|
|
}
|
|
|
|
public function historiales_venta(){
|
|
return $this ->hasMany(Historiale::class,'vendedor_id');
|
|
}
|
|
|
|
public function historiales_compra(){
|
|
return $this ->hasMany(Historiale::class,'cliente_id');
|
|
}
|
|
|
|
public function recargas(){
|
|
return $this ->hasMany(recarga::class,'usuario_id');
|
|
}
|
|
|
|
public function usuario_tarifas(){
|
|
return $this ->hasMany(Usuario_tarifa::class,'usuario_id');
|
|
}
|
|
public function usuario_promos(){
|
|
return $this ->hasMany(Usuario_promo::class,'usuario_id');
|
|
}
|
|
|
|
}
|