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();