Sometimes you might have to run old migration file. For example I encounter this error when I wanted to run migration file for Spatie’s Laravel Permission:
Access to undeclared static property Spatie\Permission\PermissionRegistrar::$pivotPermission
This happens when I ran an old migration file for that package.
Simple way to fix it:
Delete the migration file that causes this error. And then run the following to publish the latest migration file:
php artisan vendor:publish –provider=”Spatie\Permission\PermissionServiceProvider”
And now the migration file is working fine!