Files
sirpremiumv2/app/Models/Historiale.php
T
2023-10-09 14:56:06 -05:00

49 lines
1.1 KiB
PHP

<?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);
}
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');
}
}