47 lines
1.0 KiB
PHP
Executable File
47 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Cuentas extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $fillable = [
|
|
'correo',
|
|
'password',
|
|
'vencimiento',
|
|
'estado',
|
|
'tarifa_id',
|
|
'promocion_id',
|
|
'inicio',
|
|
'servicio_id'
|
|
];
|
|
|
|
public function tarifa(){
|
|
return $this ->belongsTo(Tarifas::class);
|
|
}
|
|
|
|
public function promocion(){
|
|
return $this ->belongsTo(Promociones::class);
|
|
}
|
|
|
|
public function historiales(){
|
|
return $this ->belongsToMany(Historiale::class,'historial_cuentas','cuenta_id','historial_id');
|
|
}
|
|
|
|
public function perfil(){
|
|
return $this ->hasMany(Historial_cuenta::class,'cuenta_id');
|
|
}
|
|
|
|
public function servicio(){
|
|
return $this ->belongsTo(Servicio::class);
|
|
}
|
|
|
|
public function historiales_obsoletos(){
|
|
return $this ->belongsToMany(Historiale::class,'logs','cuenta_id','historial_id');
|
|
}
|
|
|
|
}
|