Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel model custom factory

 // If you factory is out of standard, you can set an specifc
    // On your model, create a static method named newFactory

    protected static function newFactory()
    {
        return DatabaseFactoriesMyModelFactory::new();
    }

    //On your factory, add this
    protected $model = AppModelsMyModel::class;
 
PREVIOUS NEXT
Tagged: #laravel #model #custom #factory
ADD COMMENT
Topic
Name
7+5 =