meops/laravel-populate

Populate the DB in your Laravel application

1.0.4 2025-04-09 15:57 UTC

This package is auto-updated.

Last update: 2025-06-09 16:17:21 UTC


README

Packagist Tests

An Artisan command for populating your database. It allows you to quickly create records in your database using the model factories you have already defined in your Laravel application without writing seeders.

Installation

Install the package as a development dependency:

composer require --dev meops/laravel-populate

Usage

Records are created by specifying the model whose factory definition should be used to generate field values.

Create a single record

The first argument specifies the model to create. The package will look for a matching model name in the App/Models directory by default:

php artisan db:populate User

Use double backslashes to escape slashes in a fully qualified class name:

php artisan db:populate MyNamespace\\User

Create multiple records

The second argument is optional and specifies the number of records to create:

php artisan db:populate User 10

Create multiple records with custom data

Specify any fields whose values should be overriden using the -o option with the format field=value. Multiple fields can be overriden by providing multiple -o options.

php artisan db:populate User -o email=me@example.com -o password=secret

Prerequisites

Any model you wish to populate must have a factory defined.