7 changed files with 102 additions and 47 deletions
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
.analytics-container { |
||||
max-width: 800px; |
||||
margin: 0 auto; |
||||
padding: 20px; |
||||
} |
||||
|
||||
.analytics-card { |
||||
background: lightgray; |
||||
border-radius: 8px; |
||||
padding: 20px; |
||||
margin-bottom: 20px; |
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1); |
||||
} |
||||
|
||||
.analytics-table { |
||||
width: 100%; |
||||
border-collapse: collapse; |
||||
} |
||||
|
||||
.analytics-table th, .analytics-table td { |
||||
padding: 10px; |
||||
border-bottom: 1px solid var(--color-border); |
||||
} |
||||
|
||||
.analytics-table th { |
||||
text-align: left; |
||||
font-weight: 600; |
||||
} |
||||
|
||||
.text-right { |
||||
text-align: right; |
||||
} |
||||
|
||||
.analytics-info { |
||||
font-size: 0.9rem; |
||||
color: var(--color-border); |
||||
} |
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace DoctrineMigrations; |
||||
|
||||
use Doctrine\DBAL\Schema\Schema; |
||||
use Doctrine\Migrations\AbstractMigration; |
||||
|
||||
/** |
||||
* Auto-generated Migration: Please modify to your needs! |
||||
*/ |
||||
final class Version20250826151824 extends AbstractMigration |
||||
{ |
||||
public function getDescription(): string |
||||
{ |
||||
return ''; |
||||
} |
||||
|
||||
public function up(Schema $schema): void |
||||
{ |
||||
// this up() migration is auto-generated, please modify it to your needs |
||||
$this->addSql(<<<'SQL' |
||||
CREATE TABLE visit (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, route VARCHAR(255) NOT NULL, visited_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id)) |
||||
SQL); |
||||
} |
||||
|
||||
public function down(Schema $schema): void |
||||
{ |
||||
// this down() migration is auto-generated, please modify it to your needs |
||||
$this->addSql(<<<'SQL' |
||||
DROP TABLE visit |
||||
SQL); |
||||
} |
||||
} |
||||
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace App\Controller\Administration; |
||||
|
||||
use App\Repository\VisitRepository; |
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
use Symfony\Component\Routing\Attribute\Route; |
||||
|
||||
class VisitorAnalyticsController extends AbstractController |
||||
{ |
||||
#[Route('/admin/analytics', name: 'admin_analytics')] |
||||
public function index(VisitRepository $visitRepository): Response |
||||
{ |
||||
$visitStats = $visitRepository->getVisitCountByRoute(); |
||||
|
||||
return $this->render('admin/analytics.html.twig', [ |
||||
'visitStats' => $visitStats, |
||||
]); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue