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

27 lines
761 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 ZonaProduccion extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'zonas_produccion';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['id', 'nombre', 'restaurante_id'];
public static function findOrFail($id) {
$zonaProduccion = ZonaProduccion::find($id);
if(!$zonaProduccion) throw new ModelNotFoundException("zona_produccion", $id);
return $zonaProduccion;
}
public function restaurante() {
return $this->belongsTo(Restaurante::class);
}
}