public function addPlanToWatch() { if (Input::has("anime_id") && Sentry::check()) { $anime_id = Input::get("anime_id"); $user_id = Sentry::getUser()->id; if (UserLibrary::user($user_id)->anime($anime_id)->status(6)->exists()) { $anime = $this->updateLibrary($user_id, $anime_id, 0); return View::make('child.alerts', array('msg' => 'Removed from plan to watch: ' . $anime)); } $anime = $this->updateLibrary($user_id, $anime_id, 6); return View::make('child.alerts', array('msg_type' => 'info', 'msg' => 'You plan to watch: ' . $anime)); } return View::make('child.alerts', array('msg_type' => 'info', 'msg' => 'Please Sign-in/Sign-up to use this function!')); }
<?php $watched = UserLibrary::where('user_id', Sentry::getUser()->id)->where('last_watched_episode', '>', '')->where('library_status', '!=', 4)->where('last_watched_time', '>', \Carbon\Carbon::today()->subMonth())->orderBy('last_watched_time', 'DESC')->get(); ?> {{ View::make('child.anime_watched', ['series' => $watched]) }} </div> </div> </div> <div class="row-fluid"> <div class="span12"> <div class="clearfix"> <h3 class="met_title_with_childs pull-left"> PLAN TO WATCH<span class="met_subtitle">ANIME YOU STILL HAVE TO WATCH</span> </h3> </div> <?php $planned = UserLibrary::user(Sentry::getUser()->id)->status(6)->paginate(6); ?> @if(!empty($planned) && count($planned) > 0) <div class="row-fluid"> <div class="span12"> @foreach($planned as $plan) <?php $anime = Anime::findOrFail($plan->anime_id, array('id', 'name', 'mal_image')); ?> {{ View::make('child.card_anime', array("anime_id" => $anime->id, "anime_name" => $anime->name, "anime_episode" => 0, "anime_img" => $anime->mal_image, "display" => "list", "off_lazy" => true)) }} @endforeach </div> {{ $planned->links() }} </div> @else <div class="row-fluid">