PHPackages                             singlequote/laravel-model-seeder - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. singlequote/laravel-model-seeder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

singlequote/laravel-model-seeder
================================

1.0.6(2y ago)41.7kMITPHPPHP ^8.0

Since Dec 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/singlequote/laravel-model-seeder)[ Packagist](https://packagist.org/packages/singlequote/laravel-model-seeder)[ Docs](https://github.com/singlequote/laravel-model-seeder)[ RSS](/packages/singlequote-laravel-model-seeder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

Laravel Model Seeder
====================

[](#laravel-model-seeder)

Create seeders from your model using the data in your database

> This package will generate automatic seeders using your models. It supports pivot relations to automatic sync relations in pivot tables with your models.

[![Latest Version on Packagist](https://camo.githubusercontent.com/f285231c798d61b495c6fc4060e6c0032d709026ec8abf81d9708f7a2c6eeaf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e676c6571756f74652f6c61726176656c2d6d6f64656c2d7365656465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/singlequote/laravel-model-seeder)[![Total Downloads](https://camo.githubusercontent.com/88e85e7b1c96dce900e98559447f20837df54ce07ddaa90a9ea5c10b055282d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e676c6571756f74652f6c61726176656c2d6d6f64656c2d7365656465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/singlequote/laravel-model-seeder)

### Installation

[](#installation)

```
composer require singlequote/laravel-model-seeder --dev
```

### Usage

[](#usage)

The package has a single command line with a few options. The command below will generate seeders using laravels default folder structure. The seeders will be created in `database/seeders` and your models should be in `App\Models`

```
php artisan seed:make

```

### Model events

[](#model-events)

By default laravel adds the `WithoutModelEvents` trait to your seeders. The package does this also for abious reasons. If you would like to use your model events, you can add the `--with-events` option to the command.

```
php artisan seed:make --with-events
```

### Changing the package behaviour

[](#changing-the-package-behaviour)

If you moved your models to another location or you renamed your Models folder to something else you can change this in the config of the package.

#### Publish config

[](#publish-config)

Using the command you can publish the config and edit it.

```
php artisan vendor:publish --tag=model-seeder
```

The default content of the config file is:

```
