Download the PHP package sleeping-owl/seeder without Composer
On this page you can find all versions of the php package sleeping-owl/seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sleeping-owl/seeder
More information about sleeping-owl/seeder
Files in sleeping-owl/seeder
Package seeder
Short Description Package to create simple seeders with ability to lock/unlock tables
License MIT
Informations about the package seeder
Package to create simple seeders with ability to lock/unlock tables
Overview
This package will allow you to write simple seeders:
And adds 2 new commands:
-
php artisan seeder:lock <table> --all
— lock table from any changes (table data will be saved and restored after reseeding). php artisan seeder:unlock <table> --all
— unlock table for random seeding.
Installation
-
Require this packages in your composer.json and run composer update:
"fzaninotto/faker": "1.5.*@dev", "sleeping-owl/seeder": "1.*"
-
After composer update, add service providers to the
config/app.php
'SleepingOwl\Seeder\SeederServiceProvider',
- That's all.
Seeding
-
Import classes:
-
Add seeding rule for table or model:
-
Configure seeding rule (you can configure it globally, see details in "Global Configuration"):
-
Configure seeding schema (see details in "Schema Configuration"):
- Now you can use default command
php artisan db:seed
and newseeder:lock
/seeder:unlock
commands.
Global Configuration
You can configure seeding settings globally:
This configuration will be used as default for every seeder. Seeder configuration will override global configuration:
Schema Configuration
Add Field to the Schema
You must provide schema for seeding. There is 3 ways to add field to the schema:
$schema->field('my_field')
$schema->my_field
$schema->my_field()
All these 3 ways will add field my_field
to the schema.
Provide Rules for Seeding the Field
You must use fzaninotto/faker package rules:
Lock/Unlock Table Seeding
Locking
You can lock table seeding. This command will save table state and restores it with every seeding call.
You can lock one table:
Or all tables:
Unlocking
This command will delete table saved state and restores default behaviour.
or
Support Library
You can donate via PayPal or in BTC: 13k36pym383rEmsBSLyWfT3TxCQMN2Lekd
Copyright and License
Package was written by Sleeping Owl for the Laravel framework and is released under the MIT License. See the LICENSE file for details.