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

Laravel Vuejs 实战:开发知乎 (1)项目环境配置和用户表设计的更多相关文章

  1. Laravel Vuejs 实战:开发知乎 (6)发布问题

    1.view部分: 安装一个扩展包:Laravel-UEditor composer require "overtrue/laravel-ueditor:~1.0" 配置 添加下面 ...

  2. Laravel Vuejs 实战:开发知乎 (10)使用 Select2 优化话题选择

    1.添加选择Topic 使用Select2,如何安装Select2 ,具体使用实例 Select2 and Laravel: Ajax Autocomplete 及 Loading data remo ...

  3. 安卓app开发-01-开发工具及环境配置

    安卓app开发-01-开发工具及环境配置 请大家根据推荐指数和自己的意愿选择 使用 Android Studio 1.可以使用 Android Studio 下载地址:http://www.andro ...

  4. 第一篇 Windows 8 开发Windows Metro style app环境配置

    半   饱问 题 到 我 这 里 为 止! 第一篇 Windows 8 开发Windows Metro style app环境配置 2012-09-24 08:24 by 半饱, 1289 阅读, 3 ...

  5. Windows驱动开发VS2012 DDK/WDK的环境配置

    [开发Windows驱动的配置是很必要的,下文将详细介绍VS2012如何配置驱动开发环境] [转载] 以下部分内容是转载博客:http://blog.csdn.net/huangxy10/articl ...

  6. Sublime for mac 开发Golang : 一步步环境配置

    安装Golang 在官网上直接下载安装包就可以了.下载pkg格式的最新安装包 ,直接双击运行,一路按照提示操作就可以完成安装. 或者使用brew进行安装 brew install go 完成安装之后, ...

  7. 每个项目单独配置 git 用户

    git多账号登陆问题 设置git全局设置: git config --global user.name "your_name"  git config --global user. ...

  8. Laravel Vuejs 实战:开发知乎 (9)定义话题与问题关系

    1.话题[Topic] 执行命令: php artisan make:model Topic –cmr 修改****_**_**_create_topics_table.php数据库迁移文件如下: c ...

  9. Laravel Vuejs 实战:开发知乎 (8)美化编辑器

    1.使用UEditor增量包: simple-ueditors 执行下载: git clone https://github.com/JellyBool/simple-ueditor.git 2.用此 ...

随机推荐

  1. HTML学习(6)段落

    HTML段落使用<p>标签定义,浏览器会自动地在段落的前后添加空行. 如果不希望产生空行,可以使用<br />换行标签. 在元素内容中,连续的空格会被浏览器认格式化为一个空格, ...

  2. nomon+ pyNmonAnalyzer实现基于python的nmon监控性能数据可视化

    pip install pyNmonAnalyzer nnmon  for linux from sourceforge:https://sourceforge.net/projects/nmon/ ...

  3. 扩展欧几里得求解同余方程(poj 1061)

    设方程 ax + by = c , 若 gcd(a,b) 是 c的因子(记作gcd(a,b)|c)则方程有解,反之无解. 其中x0,y0是方程的一组特解 , d = gcd(a,b), poj1061 ...

  4. SQL通过Datatable更新数据库表内容

    SQL通过Datatable更新数据库表内容   //要注意的一点是在Select语句中要选择的列中必须包含主键的列,此外不支持多表连接查询 DataTable dt = new DataTable( ...

  5. sqlmap使用教程(超详细)

    -u 指定目标URL (可以是http协议也可以是https协议) -d 连接数据库 --dbs 列出所有的数据库 --current-db 列出当前数据库 --tables 列出当前的表 --col ...

  6. Axure licensee key 8~9-转

    转:https://7rp.cn/34 AxureRP v9.0.0.3646 正式版 — 亲测可用 Licensee: jasmine Key: ATocOwMG75ijKpF0OEDSHQ3UZQ ...

  7. linux中卸载mysql以及安装yum

    卸载mysql:https://blog.csdn.net/qq_41829904/article/details/92966943 链接2:https://www.cnblogs.com/nickn ...

  8. SpringMVC的三种处理器适配器

    SpringMVC具有三种处理器适配器,他们分别是BeanNameUrlHandlerMapping.SimpleControllerHandlerAdapter.ControllerClassNam ...

  9. C 语言实例 - 判断闰年

    用户输入年份,判断该年份是否为闰年. #include <stdio.h> int main() { int year; printf("输入年份: "); scanf ...

  10. CSS学习(5)更多的选择器

    1.通配符选择器 * 表示选中所有元素 *{color:red;} 2.属性选择器  根据属性名和属性值选中元素 https://developer.mozilla.org/zh-CN/docs/We ...