Skip to content

Instantly share code, notes, and snippets.

@teethgrinder
Forked from Kindari/gist:3879716
Created January 16, 2013 09:26
Show Gist options
  • Save teethgrinder/4545834 to your computer and use it in GitHub Desktop.
Save teethgrinder/4545834 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