Skip to content

Instantly share code, notes, and snippets.

@Nickstr
Created May 4, 2012 10:39
Show Gist options
  • Save Nickstr/2594029 to your computer and use it in GitHub Desktop.
Save Nickstr/2594029 to your computer and use it in GitHub Desktop.
public function __construct()
{
parent::__construct();
$this->filter('before', 'auth')->only(array('get_single'));
}
// Get Single news item
public function get_single($id, $slug = null)
{
// Get single news item
$news = News::find($id);
// Check if the news is protected and if the user is logged
if ($news->secure == 1 && !Auth::check())
{
// 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