info('๐Ÿงช Test modulo StampeRate...'); try { // Trova l'utente super-admin $user = User::where('email', 'superadmin@example.com')->first(); if (!$user) { $this->error('โŒ Utente super-admin non trovato'); return Command::FAILURE; } $this->info("โœ… Utente trovato: {$user->name} ({$user->email})"); $this->info("๐Ÿ”‘ Ruoli: " . $user->roles->pluck('name')->implode(', ')); // Simula l'autenticazione Auth::login($user); $this->info('๐Ÿ” Autenticazione simulata'); // Test permessi if ($user->can('stampe.rate.view')) { $this->info('โœ… Permesso stampe.rate.view: OK'); } else { $this->error('โŒ Permesso stampe.rate.view: MANCANTE'); } // Test query stabili $stabili = DB::table('stabili') ->where('amministratore_id', $user->id) ->select('id', 'denominazione', 'indirizzo') ->get(); $this->info("๐Ÿข Stabili trovati: " . $stabili->count()); if ($stabili->count() === 0) { $this->warn('โš ๏ธ Nessuno stabile associato all\'utente'); $this->info('๐Ÿ’ก Per testare completamente il modulo, aggiungere almeno uno stabile all\'utente nel database'); } else { foreach ($stabili->take(3) as $stabile) { $this->info(" - {$stabile->denominazione} ({$stabile->indirizzo})"); } } // Test query template $templates = DB::table('stampe_rate_templates') ->where('status', 'active') ->select('id', 'name', 'description') ->get(); $this->info("๐Ÿ“„ Template trovati: " . $templates->count()); foreach ($templates as $template) { $this->info(" - {$template->name}: {$template->description}"); } // Test view loading $this->info('๐ŸŽญ Test caricamento view...'); if (view()->exists('modules.stampe-rate.index')) { $this->info('โœ… View modules.stampe-rate.index: TROVATA'); } else { $this->error('โŒ View modules.stampe-rate.index: NON TROVATA'); // Controlla il symlink $symlink = '/var/www/netgescon/resources/views/modules/stampe-rate'; if (is_link($symlink)) { $this->info("๐Ÿ”— Symlink presente: " . readlink($symlink)); } else { $this->error("โŒ Symlink mancante: {$symlink}"); } } $this->info('๐ŸŽ‰ Test completato con successo!'); return Command::SUCCESS; } catch (\Exception $e) { $this->error("โŒ Errore durante il test: " . $e->getMessage()); $this->error("๐Ÿ“ File: " . $e->getFile() . ":{$e->getLine()}"); return Command::FAILURE; } } }