From 67a394acb8e9ccb716344adc1c070791972a62d1 Mon Sep 17 00:00:00 2001 From: lynkxyz Date: Thu, 22 Dec 2016 00:06:15 +0700 Subject: [PATCH] update --- app/Http/Controllers/HomeController.php | 3 +++ resources/views/home/main.blade.php | 12 +++++------- resources/views/home/page.blade.php | 3 ++- routes/web.php | 19 +++++++++++-------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 7ae90f2..2fc626d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -8,6 +8,7 @@ use App\Movie; use App\Episode; +use App\Counter; class HomeController extends Controller { @@ -19,5 +20,7 @@ public function index() { $newEpisodes = Episode::select('id', 'name', 'alias', 'movie_id')->limit(6)->orderBy('id', 'DESC')->get()->toArray(); return view('home.main', compact('movies', 'moviesRandom', 'moviesMostViews', 'moviesMostLikes', 'newEpisodes')); + // echo '
';
+        // print_r(Counter::show('movies', 3));
     }
 }
diff --git a/resources/views/home/main.blade.php b/resources/views/home/main.blade.php
index 5ec30cc..9b23395 100644
--- a/resources/views/home/main.blade.php
+++ b/resources/views/home/main.blade.php
@@ -39,13 +39,12 @@
         
{!! $i++ !!}
-
-

{!! $movie['name'] !!}

{{ $movie['views'] }} views +
+

{!! $movie['name'] !!}

{{ Counter::show('movies', $movie['id'] ) }} views
-
+
where('movie_id', $movie['id'])->orderBy('id', 'DESC')-> first() ?> PLAY -
@@ -67,13 +66,12 @@
{!! $i++ !!}
-
+

{!! $movie['name'] !!}

{{ $movie['likes'] }} likes
-
+
where('movie_id', $movie['id'])->orderBy('id', 'DESC')-> first() ?> PLAY -
diff --git a/resources/views/home/page.blade.php b/resources/views/home/page.blade.php index 6f73ec7..eaf15fb 100644 --- a/resources/views/home/page.blade.php +++ b/resources/views/home/page.blade.php @@ -57,6 +57,7 @@
{{ Counter::showAndCount('episodes', $episode['id'] ) }} views
+ {{ Counter::count('movies', $movie['id'] ) }}
Genre: {!! $arrGenres !!} Producer: {!! $arrProducers !!} @@ -85,7 +86,7 @@
{!! $m['name'] !!} - {!! $m['views'] !!} views
+ {{ Counter::show('movies', $m['id'] ) }} views
{!! $m['likes'] !!} likes
diff --git a/routes/web.php b/routes/web.php index 296db52..fd128d2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -22,14 +22,17 @@ }); // like -Route::post('anime/like/{id}', [ - 'as' => 'episode.like', - 'uses' => 'LikeController@like' -]); -Route::delete('anime/unlike/{id}', [ - 'as' => 'episode.unlike', - 'uses' => 'LikeController@unlike' -]); +Route::group(['prefix'=>'anime', 'middleware'=>'auth'], function() { + Route::post('like/{id}', [ + 'as' => 'episode.like', + 'uses' => 'LikeController@like' + ]); + Route::delete('unlike/{id}', [ + 'as' => 'episode.unlike', + 'uses' => 'LikeController@unlike' + ]); +}); + // search Route::get('search', [