Laravel 5.2.2 and Entrust error call to undefined method


Laravel 5.2.2 and Entrust error call to undefined method

Hi guys when using latest Laravel 5.2.2 and Entrust ("zizaco/entrust": "5.2.x-dev") I face this error and not sure how to solve this
Call to undefined method Zizaco\Entrust\EntrustServiceProvider::hasRole()

I tested this code on HomeController.php
use Entrust;

class HomeController extends Controller

    public function index()
        if (Entrust::hasRole('admin')) {
            echo "string";

        return view('home');

This is my config/app.php service provider

config/app.php facade alias
'Entrust'   => Zizaco\Entrust\EntrustFacade::class

I also already generate the model needed

Did I miss something here? Thanks in advance


Answer 1:

I have same issue, here are the steps I have taken to solve the issue

In your .env file change to cache array


and dont forget to run

php artisan config:cache

Answer 2:

It seems all the steps is correct, and I just need to clear the cache with php artisan config:cache

And if you face an error like below

BadMethodCallException in vendor\laravel\framework\src\Illuminate\Cache\Repository.php line 380:
This cache store does not support tagging.

You need to change in .env this line to array


Answer 3:

Try this:

Open environment file of your laravel change CACHE_DRIVER=file to CACHE_DRIVER=array and save.

Now try your CLI command.

Answer 4:

Laravel drivers does not support tagging. To solve this, go to your .env file and change




and run

php artisan config:cache