Skip to content

fix: eloquent model import#202

Closed
badasukerubin wants to merge 1 commit intodurable-workflow:masterfrom
badasukerubin:fix-eloquent-model-import
Closed

fix: eloquent model import#202
badasukerubin wants to merge 1 commit intodurable-workflow:masterfrom
badasukerubin:fix-eloquent-model-import

Conversation

@badasukerubin
Copy link

Thank you for this great package.
When I tested the package within another Laravel package, I got Class "Workflow\Models\Model" not found.
I was able to temporarily circumvent the issue by creating an alias in the package's ServiceProvider ie:

...
use Illuminate\Database\Eloquent\Model;
...

 if (! class_exists('Workflow\Models\Model')) {
            class_alias(
                Model::class,
                'Workflow\Models\Model'
            );
        }

, but it'd be nice not to get the error at all.

@rmcdaniel
Copy link
Member

rmcdaniel commented Feb 6, 2025

That is actually intentional and how it's meant to loaded. That's because some packages like MongoDB do not extend the Eloquent models.

https://github.com/laravel-workflow/laravel-workflow/blob/master/src/Providers/WorkflowServiceProvider.php#L30

Thank you for the PR anyways. I appreciate the time and effort you took to make it.

@rmcdaniel rmcdaniel closed this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants