Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
linrium committed Dec 21, 2016
1 parent be7b3b8 commit 67a394a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use App\Movie;
use App\Episode;
use App\Counter;

class HomeController extends Controller
{
Expand All @@ -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 '<pre>';
// print_r(Counter::show('movies', 3));
}
}
12 changes: 5 additions & 7 deletions resources/views/home/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@
<div class="row main__ritem-item">
<div class="col-md-1 col-sm-1 col-xs-1 main__ritem-numberic"><span>{!! $i++ !!}</span></div>
<div class="col-md-2 col-sm-2 col-xs-2 main__ritem-thumb"><img src="{{ url('public/img/'.$movie['thumb']) }}" alt="" /></div>
<div class="col-md-5 col-sm-7 col-xs-5 main__ritem-title">
<h2>{!! $movie['name'] !!}</h2><span>{{ $movie['views'] }} views</span>
<div class="col-md-7 col-sm-7 col-xs-5 main__ritem-title">
<h2>{!! $movie['name'] !!}</h2><span>{{ Counter::show('movies', $movie['id'] ) }} views</span>
</div>
<div class="col-md-4 col-sm-2 main__ritem-icon">
<div class="col-md-2 col-sm-2 main__ritem-icon">
<?php $lastEp = DB::table('episodes')->where('movie_id', $movie['id'])->orderBy('id', 'DESC')-> first() ?>
<a class="btn btn-nooutline-primary" href="{{ route('page.index', ['id'=>$movie['id'], 'episodeId'=>$lastEp->id]) }}">PLAY</a>
<button class="btn btn-nooutline-primary">LIKE</button>
</div>
</div>
</div>
Expand All @@ -67,13 +66,12 @@
<div class="row main__ritem-item">
<div class="col-md-1 col-sm-1 col-xs-1 main__ritem-numberic"><span>{!! $i++ !!}</span></div>
<div class="col-md-2 col-sm-2 col-xs-2 main__ritem-thumb"><img src="{{ url('public/img/'.$movie['thumb']) }}" alt="" /></div>
<div class="col-md-5 col-sm-7 col-xs-5 main__ritem-title">
<div class="col-md-7 col-sm-7 col-xs-5 main__ritem-title">
<h2>{!! $movie['name'] !!}</h2><span>{{ $movie['likes'] }} likes</span>
</div>
<div class="col-md-4 col-sm-2 main__ritem-icon">
<div class="col-md-2 col-sm-2 main__ritem-icon">
<?php $lastEp = DB::table('episodes')->where('movie_id', $movie['id'])->orderBy('id', 'DESC')-> first() ?>
<a class="btn btn-nooutline-primary" href="{{ route('page.index', ['id'=>$movie['id'], 'episodeId'=>$lastEp->id]) }}">PLAY</a>
<button class="btn btn-nooutline-primary">LIKE</button>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion resources/views/home/page.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
</span>
</div>
<div class="col-md-4"><span id="views" class="hvr-underline-from-left"> <span id="count-views" style="display: inline">{{ Counter::showAndCount('episodes', $episode['id'] ) }}</span> views</span></div>
{{ Counter::count('movies', $movie['id'] ) }}
</div>
<span class="span-inline"><i class="fa fa-list"></i> Genre: {!! $arrGenres !!}</span>
<span class="span-inline"><i class="fa fa-building"></i> Producer: {!! $arrProducers !!}</span>
Expand Down Expand Up @@ -85,7 +86,7 @@
</a>
<div class="main__watch-suggest-episode">
<a href="">{!! $m['name'] !!}</a>
<small>{!! $m['views'] !!} views</small> <br>
<small>{{ Counter::show('movies', $m['id'] ) }} views</small> <br>
<small>{!! $m['likes'] !!} likes</small>
</div>
</li>
Expand Down
19 changes: 11 additions & 8 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down

0 comments on commit 67a394a

Please sign in to comment.