Modelo de base de datos en lumen

This commit is contained in:
2021-04-20 23:38:54 -04:00
parent 70571568ad
commit 6e4076cf15
29 changed files with 530 additions and 243 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Producto extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'productos';
public function recetas() {
return $this->hasMany(Receta::class, 'producto_id');
}
public function categoria() {
return $this->belongsTo(Categoria::class);
}
public function zonaProduccion() {
return $this->belongsTo(ZonaProduccion::class);
}
public function restaurante() {
return $this->belongsTo(Restaurante::class);
}
}