Laravel 5.2: entrust migration exception

Laravel

Today I pulled a fresh Laravel 5.2 (5.2.31) installation to work on the new project in company, when I was trying to install entrust and execute the migration file I was popped by the above exception error in my Console.

Well was the exception is saying the issue is that there is no column specified for the foreign key on users table of my application.

To fix this you can easily open the entrust migration file and add your users table into it.

The reason that this happens is because when entrust is going to make the migration file it looks into config/auth.php file to lookup the name of your users table.

if you open the auth.php file you can see something similar to below in providers section:

entrust looks for table property within this array to find the name of the users table.

To fix the issue and make entrust migration generation works properly you need to add ‘table’ => ‘users’ in this array.

so the output should look like:

Then you can run php artisan entrust:migration and it will create the migration file with proper value for the foreign key reference.