"La suma de las distribuciones ({$sumaDistribucion}) debe ser igual a la cantidad total ({$cantidadTotal})." ]); } // Crear un registro por cada proveedor foreach ($distribuciones as $distribucion) { \App\Models\Ojal::create([ 'proveedor_id' => $distribucion['proveedor_id'], 'orden_produccion_id' => $ordenProduccionId, 'tipo' => $tipo, 'fecha_envio' => now(), 'cantidad_enviada' => $distribucion['cantidad'], 'terminada' => $terminada, ]); } // Redirigir al listado $this->redirect(OjalPresillaResource::getUrl('index')); // Retornar vacío para evitar que Filament intente crear el registro automáticamente return []; } protected function afterCreate(): void { // Ya se crearon los registros en mutateFormDataBeforeCreate // Redirigir al index $this->redirect(OjalPresillaResource::getUrl('index')); } protected function getRedirectUrl(): string { return OjalPresillaResource::getUrl('index'); } }