You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
Actually Illuminate\Database\Eloquent\Factories\Factory::__call method resolves factory using method name suffix i.e. calling UserFactory::new()->hasPosts(2) calls Factory::factoryForModel('post').
In the same time, assuming Post uses HasFactory, calling Post::factory() calls Factory::factoryForModel('Fully\Qualified\Post').
This makes a little bit harder to implement a custom Factory::$factoryNameResolver (required when models are not in app or app/Models or factories not in factory root namespace)
I think it should be possible to get the fully qualified class name with :
Actually
Illuminate\Database\Eloquent\Factories\Factory::__call
method resolves factory using method name suffix i.e. callingUserFactory::new()->hasPosts(2)
callsFactory::factoryForModel('post')
.In the same time, assuming
Post
usesHasFactory
, callingPost::factory()
callsFactory::factoryForModel('Fully\Qualified\Post')
.This makes a little bit harder to implement a custom
Factory::$factoryNameResolver
(required when models are not inapp
orapp/Models
or factories not in factory root namespace)I think it should be possible to get the fully qualified class name with :
instead of
see https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Eloquent/Factories/Factory.php
The text was updated successfully, but these errors were encountered: