public function getYears($year) { $data['year_name'] = $year; //Get comics published in a specific year $data['year_cover'] = Comicbooks::years($year)->select('cover_image')->orderBy('published_date', 'asc')->distinct()->get(); $data['year_works'] = Comicbooks::years($year)->select('book_name')->orderBy('published_date', 'asc')->distinct()->get(); $data['has_year'] = count($data['year_works']) ? true : false; //If there are no series published in the year (because of URL tempering), return with error message if (!$data['has_year']) { return Redirect::to('browse/year')->with('postMsg', $this->msg); } $this->layout->content = View::make('year', $data); }