Laravel 5 - 具有全局访问权限的自定义助手类

My custom helper class is this:

Located in app/bootstrap/ACL.php

class ACL {

    public function __construct(){
       //Get user from session
       //Get user permission array
    }

    public function isAllowed($key){
        return 'calling from ACL class';
    }

} 

Now, I need to access this ACL class inside all of the project controllers. So I require_once 'ACL.php'; in my app.php file.

Then inside my controller I can do the following:

class UserController extends Controller {

    public function editDetails() {

        $acl = new \ACL();
        echo $acl->isAllowed('edit-details');

        //below is the code to edit details

    }
}

This code works, but I feel there should be a Laravel 5 proper way to do this. I want to know:

1) Is this approach OK or is there a better way to achieve this?

2) Without doing $acl = new \ACL(); in every controller, can I use a global variable? Or something like this ACL::isAllowed('edit-details');

3) How can I run $acl->isAllowed('edit-details') condition in Blade templates properly?

Thanks a lot!

Why don't you simply add it to the classmaps?

"autoload": {
  "classmap": [
      "app/Classes"
  ]
}

You can then put your class into the "/classes" folder under app and just use it. Just run

composer dump-autoload

and then you can use it like other classes in laravel.