43 lines
810 B
PHP
43 lines
810 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Venta extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'codigo',
|
|
'precio_venta',
|
|
'pago_efectivo',
|
|
'pago_tarjeta_debito',
|
|
'pago_tarjeta_credito',
|
|
'pago_vales',
|
|
'estado_venta_id',
|
|
'user_id',
|
|
'is_liquidado',
|
|
];
|
|
|
|
|
|
public function estadoVenta()
|
|
{
|
|
return $this->belongsTo(EstadoVenta::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function totalAbono()
|
|
{
|
|
return ($this->pago_efectivo +
|
|
$this->pago_tarjeta_debito +
|
|
$this->pago_tarjeta_credito +
|
|
$this->pago_vales);
|
|
}
|
|
}
|