version 1.0
This commit is contained in:
42
app/Models/Venta.php
Normal file
42
app/Models/Venta.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user