Agrega Productos y sus recetas
This commit is contained in:
@@ -11,6 +11,16 @@ class Producto extends Model {
|
||||
use UuidPrimaryKey, SoftDeletes;
|
||||
|
||||
protected $table = 'productos';
|
||||
protected $fillable = [
|
||||
'id', 'nombre', 'precio_venta', 'categoria_id',
|
||||
'zona_produccion_id', 'restaurante_id'
|
||||
];
|
||||
|
||||
public static function findOrFail($id) {
|
||||
$producto = Producto::find($id);
|
||||
if(!$producto) throw new ModelNotFoundException("producto", $id);
|
||||
return $producto;
|
||||
}
|
||||
|
||||
public function recetas() {
|
||||
return $this->hasMany(Receta::class, 'producto_id');
|
||||
|
||||
Reference in New Issue
Block a user