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
  • 相关阅读:
    单div绘制多元素图
    js笔试题系列之二——数组与对象
    JS设计模式——策略模式
    js笔试题系列之三——函数
    zepto.js中的Touch事件
    java定时任务之Scheduled注解
    汤姆大叔送书,咱也科学抢书
    Asp.net Mvc自定义客户端验证(CheckBox列表的验证)
    摆脱烂项目
    我的ORM发展史
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12370134.html
Copyright © 2011-2022 走看看