<?php

namespace App\Models;

use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Venta extends Model {
    use UuidPrimaryKey, SoftDeletes;

    protected $table = 'ventas';
    protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];

    public function mesero() {
        return $this->belongsTo(Mesero::class);
    }

    public function canal() {
        return $this->belongsTo(CanalVenta::class);
    }

    public function restaurante() {
        return $this->belongsTo(Restaurante::class);
    }

    public function caja() {
        return $this->belongsTo(Caja::class);
    }

    public function medioPago() {
        return $this->belongsTo(MedioPago::class);
    }

    public function productos() {
        return $this->hasMany(VentaProducto::class);
    }
}
