-
-
Save iamtekeste/6e1a4ab3c5670a8e5f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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