51 lines
1.0 KiB
PHP
51 lines
1.0 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',
|
|
'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');
|
|
}
|
|
|
|
|
|
|
|
}
|