| 1 | <?php |
||
| 8 | class Permissions implements Permissionable |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Checks if the currently Authenticated User |
||
| 12 | * has access to a given action. |
||
| 13 | * |
||
| 14 | * @param string $class |
||
| 15 | * @param string $action |
||
| 16 | * |
||
| 17 | * @return |
||
| 18 | */ |
||
| 19 | public static function check($class = null, $action = 'view') |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Method called when a User attempts to access |
||
| 30 | * an area of the site or admin which they do |
||
| 31 | * not have the permissions to interact with. |
||
| 32 | * |
||
| 33 | * This is typically called from the CheckPermissions |
||
| 34 | * Middleware during a request (see: \LaravelFlare\Flare\Http\Middleware\CheckPermissions::handle()) |
||
| 35 | * and can be used to throw an exception, return a |
||
| 36 | * view (abort() etc.) or anything else really. |
||
| 37 | * |
||
| 38 | * @param string $class |
||
| 39 | * @param string $action |
||
| 40 | * |
||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | public static function denied($class = null, $action = 'view') |
||
| 47 | } |
||
| 48 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: