PHPackages                             cpxproject/seeders-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cpxproject/seeders-laravel

ActiveLibrary[Database &amp; ORM](/categories/database)

cpxproject/seeders-laravel
==========================

Run your seeders like migrations: once, safely, and tracked.

v1.0.1(1mo ago)21MITPHPPHP &gt;=7.4

Since Apr 1Pushed 1mo agoCompare

[ Source](https://github.com/cpxcristian/cpx-seeders-laravel)[ Packagist](https://packagist.org/packages/cpxproject/seeders-laravel)[ RSS](/packages/cpxproject-seeders-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

CPX Seeders
===========

[](#cpx-seeders)

Description: Forget about db:seed that duplicate records or the fear of running seeders in production. This module adds a tracking layer to your seeders; if it has already been executed, it will not be run again. It is the version control that your initial data needed.

The module is based on the laravel migrations structure to make it simple to understand.

List of commands:
-----------------

[](#list-of-commands)

```
php artisan make:cpx-seeder {ModelName}
```

```
php artisan cpx-seed
```

```
php artisan cpx-seed:status
```

```
php artisan cpx-migrate --seed
```

```
php artisan cpx-migrate:fresh --seed
```

```
php artisan cpx-migrate:status
```

### Command Mapping (The Laravel Way)

[](#command-mapping-the-laravel-way)

#### Seeders-only commands:

[](#seeders-only-commands)

Similarities in operation with laravel migrations:

CPX SeedersLaravel Migrations`php artisan make:cpx-seeder {ModelName}``php artisan make:migration {name}``php artisan cpx-seed``php artisan migrate``php artisan cpx-seed:status``php artisan migrate:status`#### Laravel Migrations + CPX Seeders:

[](#laravel-migrations--cpx-seeders)

These commands run laravel migrations and cpx-seeders in one command.

CPX migrationsCPX Seeders + Laravel Migrations`php artisan cpx-migrate --seed``php artisan migrate && php artisan cpx-seed``php artisan cpx-migrate:fresh --seed``php artisan migrate:fresh && php artisan cpx-seed``php artisan cpx-migrate:status``php artisan migrate:status && php artisan cpx-seed:status`Usage
-----

[](#usage)

1. Install this library.

```
composer require cpxproject/seeders
```

2. Run migrations to create the table that registers the seeders in the database.

```
php artisan migrate
```

3. Now you can start creating your seeders files. CPXseeders are created at **database/cpx\_seeders** directory.

```
php artisan make:cpx-seeder User
```

4. After you filled your seeders files, execute the command. This command only runs the seeders that have not been executed.

```
php artisan cpx-seed
```

Example
-------

[](#example)

Path: **database/cpx\_seeders/YYYY\_MM\_DD\_HHMMSS\_user\_seeder.php**

```
