iseed连接mysql_5.1组件名称:orangehill/iseed

**URL: [https://github.com/orangehill/iseed](https://github.com/orangehill/iseed)**

# Installation

## 1. Laravel 5 Add orangehill/iseed to your composer file.

edit your project's composer.json file to require orangehill/iseed.

> "require": {

> "orangehill/iseed": "dev-master"

> }

## 2. Update Composer from the CLI:

> composer update

## 3. Add the service provider by opening a app/config/app.php file, and adding a new item to the providers array.

> 'Orangehill\Iseed\IseedServiceProvider'

# Artisan command options

## [table_name]

Examples:

> php artisan iseed my_table

> php artisan iseed my_table,another_table

## force

Optional parameter which is used to automatically overwrite any existing seeds for desired tables

Example: The following command will overwrite UsersTableSeeder.php if it already exists in laravel's seeds directory.

> php artisan iseed users --force

## clean

Optional parameter which will clean app/database/seeds/DatabaseSeeder.php before creating new seed class.

Example:

> php artisan iseed users --clean

## database

Optional parameter which specifies the DB connection name.

Example:

> php artisan iseed users --database=mysql2

## max

Optional parameter which defines the maximum number of entries seeded from a specified table. In case of multiple tables, limit will be applied to all of them.

Example:

> artisan iseed users --max=10

## prerun

Optional parameter which assigns a laravel event name to be fired before seeding takes place. If an event listener returns false, seed will fail automatically. You can assign multiple preruns for multiple table names by passing an array of comma separated DB names and respectively passing a comma separated array of prerun event names.

Example: The following command will make a seed file which will fire an event named 'someEvent' before seeding takes place.

> artisan iseed users --prerun=someEvent

The following example will assign someUserEvent to users table seed, and someGroupEvent to groups table seed, to be executed before seeding.

> artisan iseed users,groups --prerun=someUserEvent,someGroupEvent

The following example will only assign a someGroupEvent to groups table seed, to be executed before seeding. Value for the users table prerun was omitted here, so users table seed will have no prerun event assigned.

> artisan iseed users,groups --prerun=,someGroupEvent

## postrun

Optional parameter which assigns a laravel event name to be fired after seeding takes place. If an event listener returns false, seed will be executed, but an exception will be thrown that the postrun failed. You can assign multiple postruns for multiple table names by passing an array of comma separated DB names and respectively passing a comma separated array of postrun event names.

Example: The following command will make a seed file which will fire an event named 'someEvent' after seeding was completed.

> artisan iseed users --postrun=someEvent

The following example will assign someUserEvent to users table seed, and someGroupEvent to groups table seed, to be executed after seeding.

> artisan iseed users,groups --postrun=someUserEvent,someGroupEvent

The following example will only assign a someGroupEvent to groups table seed, to be executed after seeding. Value for the users table postrun was omitted here, so users table seed will have no postrun event assigned.

> artisan iseed users,groups --postrun=,someGroupEvent

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值