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
Target class [Illuminate\Database\Eloquent\Factory] does not exist. #67
Labels
Comments
Thank you for the bug report.. |
Hello!
When I create a factory in a module I always get this error
Target class [Illuminate\Database\Eloquent\Factory] does not exist.
Because the factory class extends Factory
And apparently can't find it in the modules.
maybe I needed to write something in composer.json?
I can send you a project in zip or on git
…On Tue, 21 Mar 2023, 15:10 Artem Schander, ***@***.***> wrote:
Thank you for the bug report..
It would be nice if you somehow managed to use the bug template ;)
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIM52QE5RBDOZQZIADTWDUDW5GLFDANCNFSM6AAAAAAWBR3464>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It seems to me that you have a wrong namespace. |
Sorry! do you have an example of autoloading where everything works and is
configured correctly?
…On Tue, 21 Mar 2023, 18:53 Artem Schander, ***@***.***> wrote:
It seems to me that you have a wrong namespace.
See the docs
<https://l5modular.github.io/getting-started/#generating-a-module>
regarding psr-4 autoloading <https://www.php-fig.org/psr/psr-4/>
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIM52QG7G45G3LJVW6Y34H3W5HFF7ANCNFSM6AAAAAAWBR3464>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thanks!
…On Tue, 21 Mar 2023, 20:32 Artem Schander, ***@***.***> wrote:
See docs
https://l5modular.github.io/usage/#loading-additional-classes
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIM52QAIABH7W75O7UBCPHDW5HQ4DANCNFSM6AAAAAAWBR3464>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I finally figured out my problem! The problem was in
ModuleServiceProvider.php in method registerFactories!
protected function registerFactories(string $module)
{
if ($factories = $this->prepareComponent($module, 'factories')) {
$this->app->make(Factory::class)->load($factories);
}
}
вт, 21 мар. 2023 г. в 20:32, Artem Schander ***@***.***>:
… See docs
https://l5modular.github.io/usage/#loading-additional-classes
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIM52QAIABH7W75O7UBCPHDW5HQ4DANCNFSM6AAAAAAWBR3464>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
this code doesn't work in laravel 10 and laravel9 !
if ($migrations = $this->prepareComponent($module, 'migrations')) {
$this->loadMigrationsFrom($migrations);
}
I changed to
if (is_dir($factories)) {
foreach (Finder::create()->files()->name('*.php')->in($factories)
as $file) {
require $file->getRealPath();
}
}
ср, 22 мар. 2023 г. в 16:21, FLIGHT 404 ***@***.***>:
… I finally figured out my problem! The problem was in
ModuleServiceProvider.php in method registerFactories!
protected function registerFactories(string $module)
{
if ($factories = $this->prepareComponent($module, 'factories')) {
$this->app->make(Factory::class)->load($factories);
}
}
вт, 21 мар. 2023 г. в 20:32, Artem Schander ***@***.***>:
> See docs
> https://l5modular.github.io/usage/#loading-additional-classes
>
> —
> Reply to this email directly, view it on GitHub
> <#67 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AIM52QAIABH7W75O7UBCPHDW5HQ4DANCNFSM6AAAAAAWBR3464>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Factory doesn't work. Target class [Illuminate\Database\Eloquent\Factory] does not exist.
Laravel 9
The text was updated successfully, but these errors were encountered: