Files
unified-restaurant-original/backend/app/Models/CanalVenta.php

39 lines
970 B
PHP

<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CanalVenta extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'canales_venta';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['id', 'nombre', 'restaurante_id', 'sector_id', 'tipo_canal_id'];
public static function findOrFail($id) {
$canal_venta = CanalVenta::find($id);
if(!$canal_venta){
throw new ModelNotFoundException("canal_venta", $id);
}
return $canal_venta;
}
public function tipoCanal() {
return $this->belongsTo(TipoCanal::class);
}
public function sector() {
return $this->belongsTo(Sector::class);
}
public function restaurante() {
return $this->belongsTo(Restaurante::class);
}
}