Tipo + crear pedido

This commit is contained in:
Alejandro Tasistro 2024-03-19 22:34:13 -03:00
parent 59428f04b8
commit 784b4d97f8
1 changed files with 5 additions and 1 deletions

View File

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