Categories
Programming

How to fix Access to undeclared static property

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!

Categories
Programming

Composer detected issues fix (2024)

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.2.0”. You are running 8.1.18. in /Users/NAME/Documents/sites/worklist/vendor/composer/platform_check.php on line 24

To fix this issue, just do this:

brew unlink [email protected]
brew link [email protected]

composer global remove laravel/valet
composer global require laravel/valet

If you use Laravel Valet:

valet install
valet use [email protected]

That’s all. If it doesn’t work, just use this:

valet use [email protected] –force

It’s an update from my old blog post I wrote a year ago (facing similar problem, but different php version)