Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong minimal Laravel version in package.json #1217

Closed
mspiderv opened this issue Aug 22, 2023 · 3 comments · Fixed by #1121
Closed

Wrong minimal Laravel version in package.json #1217

mspiderv opened this issue Aug 22, 2023 · 3 comments · Fixed by #1121

Comments

@mspiderv
Copy link

Describe the bug
Trait Spatie\Activitylog\Traits\LogsActivity on line 371 tries to call getStorableEnumValue method on an Eloquent model. package.json file of the spatie/laravel-activitylog repository requires Laravel version ^8.0 || ^9.0 || ^10.0, but for example in Laravel 9.26.0 there was no getStorableEnumValue method implemented yet. It was added later. For example it is present in Laravel 9.52.15.

To Reproduce
Create a new Laravel 9.0.0 app (not newer version!) Then install Spatie Laravel Activity Log. Then reproduce steps here: https://spatie.be/docs/laravel-activitylog/v4/advanced-usage/logging-model-events
You will end up with the Call to undefined method App\\Models\\SomeModel::getStorableEnumValue() exception.

Expected behavior
It should automatically upgrade my Laravel app to proper version. 9.0.0 is not new enough. You should change the minimal Laravel version in package.json.

Versions (please complete the following information)

  • PHP: 8.1
  • Laravel: 9.26.0
  • Package: spatie/laravel-activitylog

Additional context
I faced this issue in Laravel 9.26.0. Then I simply upgraded my app with $ composer update. Then my Laravel version raised to 9.52.15 and the problem disappeared. So I suppose that the Laravel developers added getStorableEnumValue somewhere between version 9.26.0 and 9.52.15.

@mspiderv mspiderv added the bug label Aug 22, 2023
@Gummibeer
Copy link
Collaborator

Besides the fact that we are talking about composer.json: go ahead and provide a PR fixing it. In best case with links to the PRs/Commits that introduced that method.

@mspiderv
Copy link
Author

Yes, sorry, we talk about composer.json not about package.json as I said earlier. Im not gonna make PR. I just wanted to notice you about the bug. Have a nice day.

@sebapastore
Copy link

Hi @mspiderv , I've been looking at this issue and found that the bug was introduced in commit 1ad6f98 and then published in version 4.7.0 of the package. However, I also found that it was fixed in commit a92fde9 and released in version 4.7.2 of the package. Therefore, it appears that you might have been using version 4.7.0 or 4.7.1.

@Gummibeer, you may want to take a look at the changes made to the file src\Traits\LogsActivity.php in commit a92fde9, where this issue has already been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants