Laravel Vuejs 实战:开发知乎 (1)项目环境配置和用户表设计
2024-09-04 05:29:20
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
最新文章
- PL/SQL使用技巧
- log level
- 参数嗅探(Parameter Sniffing)(1/2)
- 欧拉路径Hrbust1351
- 【 D3.js 高级系列 — 10.0 】 思维导图
- DB2存储过程实现查询表数据,生成动态SQL,并执行
- SqlServer 允许保存对数据库中表结构的修改
- C#制作ActiveX控件及部署升级(摘自网络)
- 博客终于开通了happy
- javascript基础(三)运算
- Eclipse/MyEclipse中使用复制粘贴功能卡的解决办法
- loadrunner入门篇-Controller控制器
- 转:【Java并发编程】之一:可重入内置锁
- 201521123117 《Java程序设计》第9周学习总结
- 使用测试思路快速学习Python-适合测试工程师的学习方法
- 理解 Linux 的硬链接与软链接
- Ubuntu18.4中Apache在加不同端口的虚拟主机
- ZZNU 正约数之和
- Python 读取数据
- MongoDB的基本shell操作(三)
热门文章
- fileupload插件调用upload.parseRequest(request)解析得到空值问题
- 使用maven 打包springboot项目步骤以及所遇到的问题
- (转)JSONObject的toBean 和 fromObject
- 利用数据库管理工具(Navicat)导出数据到Excel表中
- A. DZY Loves Chessboard
- BT详解,BT原理
- cordova的安装与配置
- Error: Cannot find module 'webpack' 问题解决办法
- docker-compose介绍及部署LNMP
- boolean类型set、get方法