Skip to content

Instantly share code, notes, and snippets.

@iamtekeste
Forked from Kindari/gist:3879716
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save iamtekeste/6e1a4ab3c5670a8e5f8a to your computer and use it in GitHub Desktop.

Select an option

Save iamtekeste/6e1a4ab3c5670a8e5f8a to your computer and use it in GitHub Desktop.
<?php
Route::get('protected', array('before' => 'auth|role:admin', function() {
return "Only admins can see this";
}));
Route::filter('role', function ($role) {
if ( ! Auth::user()->has_role( $role ) )
{
return Response::error("401"); // not authorized
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment