- 登錄MySql 創(chuàng)建一個名字和lumen項目目錄下.env文件里DB_DATABASE 名字一樣的數(shù)據(jù)庫.
- 執(zhí)行
php artisan migrate
- 進行填充,執(zhí)行
php artisan db:seed
- 刷新數(shù)據(jù)庫結構并執(zhí)行數(shù)據(jù)填充
php artisan migrate:refresh --seed
- 需要添加字段的話在遷移里添加:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlightsTable extends Migration
{
/**
* 運行數(shù)據(jù)庫遷移曼尊。
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('airline');
$table->timestamps();
});
}
/**
* 回滾數(shù)據(jù)庫遷移。
*
* @return void
*/
public function down()
{
Schema::drop('flights');
}
}
然后運行php artisan migrate:refresh --seed