zoukankan      html  css  js  c++  java
  • Laravel Vuejs 实战:开发知乎 (1)项目环境配置和用户表设计

    1.使用laragon新建laravel项目 zhihu

    2.配置env文件的database设置 DB_DATABASE=zhihu

    3.分析users表需要的字段

    4.修改数据库迁移文件:

      1 class CreateUsersTable extends Migration
      2 {
      3     /**
      4      * Run the migrations.
      5      *
      6      * @return void
      7      */
      8     public function up()
      9     {
     10         Schema::create('users', function (Blueprint $table) {
     11             $table->bigIncrements('id');
     12             $table->string('name')->unique();
     13             $table->string('email')->unique();
     14             $table->timestamp('email_verified_at')->nullable();
     15             $table->string('password');
     16             $table->string('activation_token', 40);
     17             $table->smallInteger('activated')->default(0);
     18             $table->string('avatar');
     19             $table->integer('questions_count')->default(0);
     20             $table->integer('answers_count')->default(0);
     21             $table->integer('comments_count')->default(0);
     22             $table->integer('favorites_count')->default(0);
     23             $table->integer('likes_count')->default(0);
     24             $table->integer('followers_count')->default(0);
     25             $table->integer('followings_count')->default(0);
     26             $table->json('settings')->nullable();
     27             $table->rememberToken();
     28             $table->timestamps();
     29         });
     30     }
     31 
     32     /**
     33      * Reverse the migrations.
     34      *
     35      * @return void
     36      */
     37     public function down()
     38     {
     39         Schema::dropIfExists('users');
     40     }
     41 }

    5.执行

      1 php artisan migrate
  • 相关阅读:
    C#
    C#
    C#
    C#
    C#
    C#
    系统工具
    远程登录
    文件传输服务
    软件安装
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12370134.html
Copyright © 2011-2022 走看看