Created
April 14, 2018 09:53
-
-
Save Mombuyish/0042a3918ffe4772ec2c6e5754a09e63 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 | |
abort_if(! Auth::user()->isAdmin(), 403); | |
abort_if(! Auth::user()->isAdmin(), 403, 'Sorry, you are not an admin'); | |
abort_if(Auth::user()->isCustomer(), 403); | |
// In "admin" specific controller | |
public function index() | |
{ | |
if (! Auth::user()->isAdmin()) { | |
abort(403, 'Sorry, you are not an admin'); | |
} | |
} | |
// better! | |
public function index() | |
{ | |
abort_if(! Auth::user()->isAdmin(), 403); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment