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
  • 相关阅读:
    P1030 求先序排列 P1305 新二叉树
    spfa
    Clairewd’s message ekmp
    Cyclic Nacklace hdu3746 kmp 最小循环节
    P1233 木棍加工 dp LIS
    P1052 过河 线性dp 路径压缩
    Best Reward 拓展kmp
    Period kmp
    Substrings kmp
    Count the string kmp
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12370134.html
Copyright © 2011-2022 走看看