diff --git a/app/Http/Controllers/AdminPaginationController.php b/app/Http/Controllers/AdminPaginationController.php index 9add38d..f7d7a79 100644 --- a/app/Http/Controllers/AdminPaginationController.php +++ b/app/Http/Controllers/AdminPaginationController.php @@ -113,6 +113,16 @@ class AdminPaginationController extends Controller { Delete '; }) + ->editColumn('clicks', function ($link) { + if (env('SETTING_ADV_ANALYTICS')) { + return $link->clicks . ' + + '; + } + else { + return $link->clicks; + } + }) ->escapeColumns(['short_url', 'long_url', 'creator']) ->make(true); } @@ -125,7 +135,17 @@ class AdminPaginationController extends Controller { ->select(['short_url', 'long_url', 'clicks', 'created_at']); return Datatables::of($user_links) - ->escapeColumns() + ->editColumn('clicks', function ($link) { + if (env('SETTING_ADV_ANALYTICS')) { + return $link->clicks . ' + + '; + } + else { + return $link->clicks; + } + }) + ->escapeColumns(['short_url', 'long_url']) ->make(true); } } diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php index edf2d44..456f917 100644 --- a/app/Http/Controllers/StatsController.php +++ b/app/Http/Controllers/StatsController.php @@ -56,6 +56,9 @@ class StatsController extends Controller { if ($link == null) { return redirect(route('admin'))->with('error', 'Cannot show stats for nonexistent link.'); } + if (!env('SETTING_ADV_ANALYTICS')) { + return redirect(route('login'))->with('error', 'Please enable advanced analytics to view this page.'); + } $link_id = $link->id; diff --git a/public/css/admin.css b/public/css/admin.css index b3e4d1e..f33a96d 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -2,6 +2,10 @@ margin-bottom: 5px; } +.stats-icon { + margin-left: 0.3em; +} + .change-password { width: 150px; } diff --git a/public/css/stats.css b/public/css/stats.css index d012685..918ae6f 100644 --- a/public/css/stats.css +++ b/public/css/stats.css @@ -14,3 +14,7 @@ .ng-root { margin-bottom: 4em; } + +h4 { + display: inline-block; +} diff --git a/resources/views/link_stats.blade.php b/resources/views/link_stats.blade.php index df3e59b..14963d0 100644 --- a/resources/views/link_stats.blade.php +++ b/resources/views/link_stats.blade.php @@ -12,16 +12,20 @@
- Short Link: {{ env('APP_ADDRESS') }}/{{ $link->short_url }} + Short Link: + + {{ env('APP_ADDRESS') }}/{{ $link->short_url }} +
- Long Link: {{ $link->long_url }} + Long Link: + {{ $link->long_url }}