From fe1c9b3edb48d7453c86da92c0e9caaaabc9eeec Mon Sep 17 00:00:00 2001 From: Erik Campobadal Date: Wed, 3 May 2017 00:29:33 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Controllers/APIController.php | 3 ++- src/Controllers/StatisticController.php | 10 ++++++---- src/Routes/api.php | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Controllers/APIController.php b/src/Controllers/APIController.php index 1a22cdb..5538967 100644 --- a/src/Controllers/APIController.php +++ b/src/Controllers/APIController.php @@ -3,8 +3,8 @@ namespace Laralum\Statistics\Controllers; use App\Http\Controllers\Controller; -use Laralum\Statistics\Models\View; use Illuminate\Http\Request; +use Laralum\Statistics\Models\View; class APIController extends Controller { @@ -72,6 +72,7 @@ public function getMostUsedLanguage(Request $request) * Get the most used resource. * * @param string $resource + * * @return \Illuminate\Http\Response */ private function mostUsed($resource) diff --git a/src/Controllers/StatisticController.php b/src/Controllers/StatisticController.php index 5f39fde..23e2d77 100755 --- a/src/Controllers/StatisticController.php +++ b/src/Controllers/StatisticController.php @@ -15,7 +15,9 @@ class StatisticController extends Controller */ public function index() { - $labels = []; $normal_views = []; $unique_views = []; + $labels = []; + $normal_views = []; + $unique_views = []; $all_views = View::all(); for ($i = 0; $i < 7; $i++) { @@ -31,7 +33,7 @@ public function index() ->labels(array_reverse($labels)) ->dataset(__('laralum_statistics::general.views'), array_reverse($normal_views)) ->dataset(__('laralum_statistics::general.unique_visitors'), array_reverse($unique_views)); - + $labels = $all_views->unique('os')->pluck('os'); $values = []; @@ -60,8 +62,8 @@ public function index() return view('laralum_statistics::index', [ 'latest_views_chart' => $latest_views_chart, - 'browsers_chart' => $browsers_chart, - 'oss_chart' => $oss_chart + 'browsers_chart' => $browsers_chart, + 'oss_chart' => $oss_chart, ]); } diff --git a/src/Routes/api.php b/src/Routes/api.php index 6fce62d..9e87563 100644 --- a/src/Routes/api.php +++ b/src/Routes/api.php @@ -14,4 +14,4 @@ Route::post('/statistics/most/os', 'APIController@getMostUsedOs')->name('statistics.mostUsedOs'); Route::post('/statistics/most/browser', 'APIController@getMostUsedBrowser')->name('statistics.mostUsedBrowser'); Route::post('/statistics/most/language', 'APIController@getMostUsedLanguage')->name('statistics.mostUsedLanguage'); -}); \ No newline at end of file + });