public function index() { $artworks = Artwork::where(['state' => 0])->orderBy('id', 'DESC')->take(12)->get(); $artCount = Artwork::where('state', 0)->count(); TagsHelper::addTagsToCollection($artworks); return View::make('index', compact('artworks', 'artCount')); }
public function news() { $articles = News::whereState(0)->get(); foreach ($articles as $article) { $article->content = substr($article->content, 0, 150) . '...'; } TagsHelper::addTagsToCollection($articles); return Response::json($articles->reverse(), 200); }
public function showArchived() { if (Auth::check() && Auth::user()->hasOnePrivelege(['Moderator', 'Administrator'])) { $artworks = Artwork::where(['state' => 1])->get(); $artCount = Artwork::where('state', 1)->count(); TagsHelper::addTagsToCollection($artworks); return View::make('gallery/archive', compact('artworks', 'artCount')); } else { return View::make('errors/' . HttpCode::NotFound); } }