update
This commit is contained in:
+14
-25
@@ -12,11 +12,6 @@ class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
@@ -24,24 +19,16 @@ class User extends Authenticatable
|
||||
'cedula',
|
||||
'estado',
|
||||
'img_perfil',
|
||||
'rol_id'
|
||||
'rol_id',
|
||||
'subvendedor_id',
|
||||
'subvendedor',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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',
|
||||
];
|
||||
@@ -51,46 +38,47 @@ class User extends Authenticatable
|
||||
return $this->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function saldo()
|
||||
public function saldo()
|
||||
{
|
||||
return $this->hasOne(Saldo::class, 'usuario_id');
|
||||
}
|
||||
|
||||
public function modificaciones()
|
||||
public function modificaciones()
|
||||
{
|
||||
return $this->hasOne(Configuracione::class, 'usermodifico_id');
|
||||
}
|
||||
|
||||
public function permisos()
|
||||
public function permisos()
|
||||
{
|
||||
return $this->hasMany(Permiso::class, 'usuario_id');
|
||||
}
|
||||
|
||||
public function preferenciales()
|
||||
public function preferenciales()
|
||||
{
|
||||
return $this->hasMany(Preferencial::class, 'usuario_id');
|
||||
}
|
||||
|
||||
public function historiales_venta()
|
||||
public function historiales_venta()
|
||||
{
|
||||
return $this->hasMany(Historiale::class, 'vendedor_id');
|
||||
}
|
||||
|
||||
public function historiales_compra()
|
||||
public function historiales_compra()
|
||||
{
|
||||
return $this->hasMany(Historiale::class, 'cliente_id');
|
||||
}
|
||||
|
||||
public function recargas()
|
||||
public function recargas()
|
||||
{
|
||||
return $this->hasMany(recarga::class, 'usuario_id');
|
||||
}
|
||||
|
||||
public function usuario_tarifas()
|
||||
public function usuario_tarifas()
|
||||
{
|
||||
return $this->hasMany(Usuario_tarifa::class, 'usuario_id');
|
||||
}
|
||||
public function usuario_promos()
|
||||
|
||||
public function usuario_promos()
|
||||
{
|
||||
return $this->hasMany(Usuario_promo::class, 'usuario_id');
|
||||
}
|
||||
@@ -99,6 +87,7 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->usuario_tarifas()->where('visible', 'true')->count();
|
||||
}
|
||||
|
||||
public function countActivePromos()
|
||||
{
|
||||
return $this->usuario_promos()->where('visible', 'true')->count();
|
||||
|
||||
Reference in New Issue
Block a user