Skip to content

Instantly share code, notes, and snippets.

@vespakoen
Forked from Nickstr/gist:2593900
Created May 4, 2012 10:27
Show Gist options
  • Save vespakoen/2593919 to your computer and use it in GitHub Desktop.
Save vespakoen/2593919 to your computer and use it in GitHub Desktop.
<?php
public function __construct()
{
parent::__construct();
$this->filter('before', 'auth');
}
// Get Single news item
public function get_single($id, $slug = null)
{
// Get single news item
$news = News::first($id);
// Check if the news is protected and if the user is logged
if ($news->secure == 1)
{
// News is protected and user is not logged in
return Redirect::to('gebruiker/inloggen');
}
// News is protected and user is logged in, continue to news item
return View::make('front/news/single')->with('news', $news);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment