From 784b4d97f86f0b8ad0a2856558af9c9397bc5324 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 19 Mar 2024 22:34:13 -0300 Subject: [PATCH] Tipo + crear pedido --- app/Models/Barrio.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/Barrio.php b/app/Models/Barrio.php index 1f99f1b..f8cd602 100644 --- a/app/Models/Barrio.php +++ b/app/Models/Barrio.php @@ -33,11 +33,15 @@ public function pedidos(): HasMany return $this->hasMany(Pedido::class); } + function crearPedido(string $nombre) : Pedido { + return $this->pedidos()->create(['name' => $name]); + } + function pedidosConfirmados() { return $this->pedidos()->where('confirmed',true); } - private function calcularTotalConfirmados($closure = null) : float { + private function calcularTotalConfirmados(Closure $closure = null) : float { if (!$closure) $closure = fn($p) => $p->totalChismosa();