New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

mcmatters/laravel-factory-generators

142 4
Install
composer require mcmatters/laravel-factory-generators
Latest Version:v1.1
PHP:>=7.0
Laravel:5 · 6 · 7
License:MIT
Last Updated:Jun 13, 2020
Links: GitHub  ·  Packagist
Maintainer: MCMatters

Laravel Factory Generators

Generate factories for all non-created factories of models.

Installation

composer require mcmatters/laravel-factory-generators

Include the service provider within your config/app.php file.

'providers' => [
    McMatters\FactoryGenerators\ServiceProvider::class,
]

Publish the configuration.

php artisan vendor:publish --provider="McMatters\FactoryGenerators\ServiceProvider"

Then open the config/factory-generators.php and configure paths where your models are locating.

Advanced configuration

Name Description
folders models - path where models are locating
factories - path where factories are locating.
follow_subdirectories Enable this option if your models are in subdirectories and you wish to keep the structure of the folders. For example, if your model has next namespace: App\Models\User\Profile it will generate in your factories folder subdirectory with name User including ProfileFactory.php file.
NOTE: If you enable this option, please specify the root namespace.
model_namespace Requires only, if you enabled option above.
types An array of custom types for DBAL. For example: 'json' => 'string'.
prefix Prefix for factory files.
suffix Suffix for factory files.
skip_columns An array of the global column names for skipping, for example, you may wish to skip created_at and updated_at columns in all models.
skip_models An array of the fully qualified model names for skipping.
skip_model_columns An associative array with skipping columns for specific model. Example: 'App\Models\User' => ['password', 'remember_token'].
align_array_keys If this option will be enabled, all your factories will include aligned array keys.

Usage

Just run the command php artisan factory:generate.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

651,963,193 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

518,004,183 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

435,097,283 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

407,699,310 4,663

Version History

Version Released PHP Laravel License
v1.1 >=7.0 ^5.2 || 6.* || 7.* MIT
v1.0.4 >=7.0 ^5.2 MIT
v1.0.3 >=7.0 ^5.2 MIT
v1.0.2 >=7.0 ^5.2 MIT
v1.0.1 >=7.0 5.* MIT