创建迁移文件 auth 认证表 users

创建迁移文件users和password_resets

php artisan make:migration create_users_table --create=users
php artisan make:migration create_password_resets_table --create=password_resets

迁移文件存放目录 根目录下database/migrations/file.php 分别修改迁移文件的up
迁移文件使用:https://learnku.com/docs/laravel/5.5/migrations/1329

    /2018_11_05_023518_create_users_table.php
     Schema::create('users', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->increments('id');
        $table->string('name')->comment('用户名称');
        $table->string('email')->unique()->comment('用户邮箱');
        $table->string('password')->comment('密码');
        $table->string('remember_token',100)->nullable()->comment('认证');
        $table->timestamps();
    });

    // 2018_11_05_024615_create_password_resets_table.php
    Schema::create('password_resets', function (Blueprint $table) {
        $table->increments('id');
        $table->string('email')->unique()->comment('用户邮箱');
        $table->string('token');
        $table->timestamps();
    });

然后执行

    php artisan migrate

或者手动创建

    CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `password_resets` (
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  KEY `password_resets_email_index` (`email`),
  KEY `password_resets_token_index` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

然后就可以访问http://127.0.0.1:8081/register //认证

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!