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

35 lines
817 B
PHP

<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CanalVenta extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'canales_venta';
public static function findOrNull($id) {
try {
return CanalVenta::find($id);
} catch (QueryException $ex) {
Log::warning('Se intento obtener un canal de venta con un id invalido', ['id' => $id]);
return null;
}
}
public function tipoCanal() {
return $this->belongsTo(TipoCanal::class);
}
public function sector() {
return $this->belongsTo(Sector::class);
}
public function restaurante() {
return $this->belongsTo(Restaurante::class);
}
}