lucidarch / laravel

[DEPRECATED] See https://github.com/lucidarch/lucid

Home Page:https://lucidarch.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatiblity with Laravel8-ModelFactories

kohlerdominik opened this issue · comments

Hi there

Is the Boilerplate incompatbile with Laravel8 ModelFactories?

The reworked implementation guesses Factory-Names by default. It takes the Container-Namespace and strips it from the Model-Class, then prepends it it with the new path.

But because in Lucid, the Container lives in \Framework namespaces, while Models live in \App-Namespace, the Namespace gets not stripped correctly. Sure, its possible to overwrite that, but it's not very convenient.


From Factoy.php::704:

$appNamespace = static::appNamespace();
// $appNamespace = "Framework"

$modelName = Str::startsWith($modelName, $appNamespace.'Models\\')
    ? Str::after($modelName, $appNamespace.'Models\\')
    : Str::after($modelName, $appNamespace);
// $modelName = "App\Data\Models\User"

return static::$namespace.$modelName.'Factory';
// return = "Database\Factories\App\Data\Models\UserFactory"

@kohlerdominik some insider info, the boilerplates are going to be deprecated soon for the new method of installation. The docs and more info on the changes coming up early next week! Meanwhile, please go ahead and check the new docs at https://docs.lucidarch.dev. It has been tested with L8 to work as expected with factories too.

TL;DR: You'll need to install Laravel 8 and then require Lucid with composer require lucidarch/lucid - release for 1.0 coming out this week, no changes coming up anytime soon until then so it's safe!

Please let me know if this makes it better for you.

@kohlerdominik we're out! Closing in favour of https://github.com/lucidarch/lucid. If any issue occurs please report it on that repo instead. Much appreciated!