Export your database into Seeds

1.0.0 2017-02-02 15:07 UTC

This package is not auto-updated.

Last update: 2022-01-12 18:58:14 UTC


Seeder creates an artisan command that lets you quickly create seeds from your existing database.


Via Composer

composer require karakhanyans/seeder

In your app/config/app.php file, add the following to the providers array:



Once installed, you should see generate:seed as one of the artisan commands when you run:

php artisan list

For example:

php artisan generate:seed

This would create seed files in your database/seeds directory with a php files, which would contain the following stub:


use Illuminate\Database\Seeder;

class UserSeed extends Seeder

	* Run the database seeds.
	* @return void

	 protected $users;

	 public function setUsers(){
		$this->users = //serialized data;

	 public function run(){
		 foreach(unserialize($this->users) as $item){
			}catch (\Exception $e){
				\Illuminate\Support\Facades\Log::info('Duplicate entry for user: '.$item['id']);


In your database/seeds/DatabaseSeeder.php file, add the following to the run() action to call all new seeds:


If your models in specific folder you should use {folder} argument to generate your Seeds from that folder.

 php artisan generate:seed Models

If you want to get all your models recursively you can use the following command with -r flag:

php artisan generate:seed Models -r


For Users table please remove $hidden array to make sure that Seeder will contain all database fields.

protected $hidden = ['password', 'remember_token'];

Change log

Please see CHANGELOG for more information what has changed recently.


Please see CONTRIBUTING and CONDUCT for details.


If you discover any security related issues, please email karakhanyansa@gmail.com.



The MIT License (MIT). Please see License File for more information.