创建迁移文件 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 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

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