61 lines
1.2 KiB
PHP
Executable File
61 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Historiale extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'fecha_inicio',
|
|
'fecha_final',
|
|
'valor',
|
|
'utilidad',
|
|
'tipo_pago',
|
|
'estado',
|
|
'vendedor_id',
|
|
'tarifa_id',
|
|
'promocion_id',
|
|
'cliente_id',
|
|
'nombre_cliente'
|
|
];
|
|
|
|
public function vendedor()
|
|
{
|
|
return $this->belongsTo(User::class, 'vendedor_id');
|
|
}
|
|
|
|
public function tarifa()
|
|
{
|
|
return $this->belongsTo(Tarifas::class);
|
|
}
|
|
|
|
public function promocion()
|
|
{
|
|
return $this->belongsTo(Promociones::class);
|
|
}
|
|
|
|
public function cliente()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function cuentas()
|
|
{
|
|
return $this->belongsToMany(Cuentas::class, 'historial_cuentas', 'historial_id', 'cuenta_id');
|
|
}
|
|
|
|
public function cuentas_obsoletas()
|
|
{
|
|
return $this->belongsToMany(Cuentas::class, 'logs', 'historial_id', 'cuenta_id');
|
|
}
|
|
|
|
public function compatibilidadDgo()
|
|
{
|
|
return $this->hasOne(CompatibilidadDgo::class, 'historial_id');
|
|
}
|
|
}
|