-
-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
❗ Issue: create() Throws “Non-static method should not be called statically”
Description
When attempting to generate an avatar in a Blade template using the Laravolt Avatar package, the following error occurs:
Non-static method Laravolt\Avatar\Avatar::create() cannot be called statically
This happens when following older documentation examples that use:
Avatar::create('Name')->toBase64();Cause
The create() method is an instance method, not static:
public function create(string $name): staticCalling it statically triggers a fatal error.
Environment
- PHP 8.3.x
- Laravel 12.x
- Laravolt/Avatar (latest version)
- Blade view rendering
Steps to Reproduce
- Install the package
- Use the following in a Blade file:
{{ Avatar::create('John Doe')->toBase64() }}- Load the view
- Error is thrown
Expected Behavior
Using the Avatar facade should correctly resolve the service container instance and allow proxying the create() instance method.
Actual Behavior
The static call triggers:
Non-static method Laravolt\Avatar\Avatar::create() cannot be called statically
Workaround
This works correctly:
{{ app('avatar')->create('John Doe')->toBase64() }}Suggested Fix
- Ensure the facade proxies instance methods properly, or
- Update the documentation to reflect the correct usage pattern, or
- Adjust the API to support static usage for consistency with previous versions.
Metadata
Metadata
Assignees
Labels
No labels