以下为用到的迁移文件
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email');
$table->timestamps();
});
Schema::create('logins', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->string('ip_address');
$table->timestamps();
});
创建数据填充文件 seeder
php artisan make:seeder UsersTableSeeder
编写文件
DB::table('users')->insert(
[
[
'name' => '张三',
'email' => '10@qq.com',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now()
],
[
'name' => '李四',