Git Product home page Git Product logo

laravel-factory-generator's Introduction

Generate Laravel Factory Templates

Make Laravel factory file with the column names of a table in a database.

screenshot

Installing

composer require --dev aiiro/laravel-factory-generator

If you are using Laravel 5.5 or higher, the package will be automatically registered.

Configuration

Optionally, you can publish the config file by running this command.

php artisan vendor:publish --provider="Aiiro\Factory\FactoryGeneratorServiceProvider"

And then, you can find config\factory-generator.php.

<?php

return [
    
    /**
     * Set the namespace of the model.
     */
    'namespace' => [
        'model' => 'App',
    ],

    /**
     * List of the columns that will not appear in the factory.
     */
    'ignored_columns' => [
        'id',
    ],
];

Usage

After installing and Configuration, you can generate the factory file by running the following command.

Please pass the table name to generate:factory command as the argument.

php artisan generate:factory some_samples

NOTE This command connects to the database to retrieve the columns from table, so make sure that the database is configured.

To generate factories of all tables in database.

Use --all option without table name, to generate factories of all tables in database.

If a factory of table exists, it will be skipped and continue to generate factories of other tables.

php artisan generate:factory  --all

If you cannot use configuration after publishing

clear cache with below command. php artisan config:clear

License

This project is released under MIT License. See MIT License for the detail.

laravel-factory-generator's People

Contributors

aiiro avatar dependabot[bot] avatar kory- avatar tomohirohiratsuka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-factory-generator's Issues

How to generate all table`s factory whit one command?

Hello,I can use this command to generate table users
php artisan generate:factory users
But I have lots of tables.
I want to generate all tables factories use one command.
such us
php artisan generate:factory

is there a way to do this?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.