Laravel user permission system
I see a lot of if-else statements that could be improved upon.

Ones like these for example, are returning a boolean variable depending on an if-else statement with nothing else inside.

In those cases you can return boolean values directly.


  if(in_array($method, $this-&gt;unguarded, true)) {
      return true;
  }



into:

return (in_array($method, $this-unguarded, true));




The following code does the same thing for both 'cases', meaning that no matter what 'Request::ajax()' is, the same result will be given:


public function accessDenied() {
    if(Request::ajax()) {
        return Response::make('You cannot access this!', 403);
    }

    return Response::make('You cannot access this!', 403);
}



Which could simply be turned into:

public function accessDenied() {
    return Response::make('You cannot access this!', 403);
}




Your usage of the following code really bothers me, and I believe it could do with refactoring:


return strtolower(
        substr(
            $controller,
            strrpos($controller, '\\'),
            - 10 // 'controller' word
        ) . '.' . $method
    );