add migrate and seed
This commit is contained in:
parent
31c665249f
commit
add97097fd
|
@ -14,12 +14,11 @@ class CreateUsersTable extends Migration
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id')->comment('主键ID');
|
||||||
$table->string('name');
|
$table->string('name',12)->unique()->comment('用户名称');
|
||||||
$table->string('email')->unique();
|
$table->string('password',80)->comment('密码');
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->text('last_token')->nullable()->comment('登陆时的token');
|
||||||
$table->string('password');
|
$table->tinyInteger('status')->default(0)->comment('用户状态 -1代表已删除 0代表正常 1代表冻结');
|
||||||
$table->rememberToken();
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
|
|
||||||
class CreatePasswordResetsTable extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::create('password_resets', function (Blueprint $table) {
|
|
||||||
$table->string('email')->index();
|
|
||||||
$table->string('token');
|
|
||||||
$table->timestamp('created_at')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('password_resets');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateAdminsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('admins', function (Blueprint $table) {
|
||||||
|
$table->increments('id')->comment('主键ID');
|
||||||
|
$table->string('name',12)->unique()->comment('用户名称');
|
||||||
|
$table->string('password',80)->comment('密码');
|
||||||
|
$table->text('last_token')->nullable()->comment('登陆时的token');
|
||||||
|
$table->tinyInteger('status')->default(0)->comment('用户状态 -1代表已删除 0代表正常 1代表冻结');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('admins');
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,5 +12,15 @@ class DatabaseSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// $this->call(UsersTableSeeder::class);
|
// $this->call(UsersTableSeeder::class);
|
||||||
|
for($i=1;$i<=2;$i++){
|
||||||
|
DB::table('users')->insert([
|
||||||
|
'name' => 'guaosi'.$i,
|
||||||
|
'password' => bcrypt('12345678'),
|
||||||
|
]);
|
||||||
|
DB::table('admins')->insert([
|
||||||
|
'name' => 'guaosi'.(122+$i),
|
||||||
|
'password' => bcrypt('12345678'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue