From a3ecb4f2573d1bc4a2bb1195278ac7969054d044 Mon Sep 17 00:00:00 2001 From: Grant Holle Date: Sun, 15 Oct 2023 09:38:51 +0400 Subject: [PATCH 1/4] Add filter for dashboard based on uri --- composer.json | 3 +++ resources/views/dashboard.blade.php | 2 +- resources/views/data/filter.blade.php | 13 +++++++++++ resources/views/data/pages-card.blade.php | 2 +- src/Http/Controllers/HomeController.php | 28 ++++++++++++++--------- src/Models/PageView.php | 7 ++++++ tests/Feature/DashboardTest.php | 21 +++++++++++++++++ 7 files changed, 63 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 5c856fa..b7b9fd2 100644 --- a/composer.json +++ b/composer.json @@ -46,5 +46,8 @@ "require-dev": { "orchestra/testbench": "6.0", "phpunit/phpunit": "^9.5" + }, + "scripts": { + "test": "phpunit" } } diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index ef5b3f1..cb54d05 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -5,7 +5,7 @@ Laravel Analytics - +
diff --git a/resources/views/data/filter.blade.php b/resources/views/data/filter.blade.php index a99713d..b7d9c3e 100644 --- a/resources/views/data/filter.blade.php +++ b/resources/views/data/filter.blade.php @@ -1,3 +1,16 @@ +@if($uri) + + uri: {{ $uri }} + + Remove + + + + + + +@endif +
diff --git a/resources/views/data/filter.blade.php b/resources/views/data/filter.blade.php index b7d9c3e..56cb7ff 100644 --- a/resources/views/data/filter.blade.php +++ b/resources/views/data/filter.blade.php @@ -1,31 +1,32 @@ -@if($uri) - - uri: {{ $uri }} - - Remove - - - - - - -@endif +
+ @if ($uri) +
+ URI: {{ $uri }} + + Remove + + + + +
+ @endif -
-
- -
+
+
+ +
- diff --git a/resources/views/data/pages-card.blade.php b/resources/views/data/pages-card.blade.php index f60d1bb..55703dc 100644 --- a/resources/views/data/pages-card.blade.php +++ b/resources/views/data/pages-card.blade.php @@ -7,15 +7,19 @@
Users
- @foreach ($pages as $page) + @forelse ($pages as $page)
{{ $page->users }}
- @endforeach + @empty +
+
No data
+
+ @endforelse
diff --git a/resources/views/data/sources-card.blade.php b/resources/views/data/sources-card.blade.php index 47ca102..a9401cb 100644 --- a/resources/views/data/sources-card.blade.php +++ b/resources/views/data/sources-card.blade.php @@ -7,7 +7,7 @@
Users
- @foreach ($sources as $source) + @forelse ($sources as $source)
@@ -20,6 +20,10 @@
{{ $source->users }}
- @endforeach + @empty +
+
No data
+
+ @endforelse
diff --git a/resources/views/data/users-card.blade.php b/resources/views/data/users-card.blade.php index aee59b5..5085995 100644 --- a/resources/views/data/users-card.blade.php +++ b/resources/views/data/users-card.blade.php @@ -7,11 +7,15 @@
Users
- @foreach ($users as $user) + @forelse ($users as $user)
{{ $user->country }}
{{ $user->users }}
- @endforeach + @empty +
+
No data
+
+ @endforelse
diff --git a/resources/views/data/utm-card.blade.php b/resources/views/data/utm-card.blade.php index 654b3c4..0c3e07f 100644 --- a/resources/views/data/utm-card.blade.php +++ b/resources/views/data/utm-card.blade.php @@ -7,11 +7,15 @@
Count
- @foreach ($data['items'] as $item) + @forelse ($data['items'] as $item)
{{ $item['value'] }}
{{ $item['count'] }}
- @endforeach + @empty +
+
No data
+
+ @endforelse
diff --git a/src/Http/Controllers/HomeController.php b/src/Http/Controllers/HomeController.php index 0444146..649e3ab 100644 --- a/src/Http/Controllers/HomeController.php +++ b/src/Http/Controllers/HomeController.php @@ -11,7 +11,7 @@ class HomeController extends Controller { - protected array $scopes; + protected array $scopes = []; public function index(Request $request): View { From c23b1993d26873a76a05fea3fd97e37f797994f2 Mon Sep 17 00:00:00 2001 From: Andreas Elia Date: Thu, 26 Oct 2023 22:55:08 +0100 Subject: [PATCH 4/4] update uri filter display --- resources/views/data/filter.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/data/filter.blade.php b/resources/views/data/filter.blade.php index 56cb7ff..98602ec 100644 --- a/resources/views/data/filter.blade.php +++ b/resources/views/data/filter.blade.php @@ -1,10 +1,10 @@
@if ($uri) -