惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
IT之家
IT之家
博客园_首页
量子位
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
博客园 - 聂微东
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

mafeifan 的编程技术分享

mafengwo-mp3-downloader | mafeifan 的编程技术分享 示例页面 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 查看 default namespace 下的 default service account名称 mafeifan 的编程技术分享 检查日志 | mafeifan 的编程技术分享 bridge fdb show dev flannel.1 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享
mafeifan 的编程技术分享
2026-01-16 · via mafeifan 的编程技术分享

本节新建一个全新的laravel5.4项目及为user表添加一些字段

  1. 新建laravel项目 laravel new zhihu-app

  2. 配置.env,主要改下数据库连接信息

  3. 配置vhost,如果用的homestead,可能还要改他的配置文件

  4. 修改user表 打开 2014_10_12_000000_create_users_table.php 添加一些字段

  public function up()
  {
    Schema::create('users', function (Blueprint $table) {
      $table->increments('id');
      $table->string('name')->unique();
      $table->string('email')->unique();
      $table->string('password');
      $table->string('avatar');
      // 激活token
      $table->string('confirmation_token');
      // 是否激活邮箱
      $table->smallInteger('is_active')->default(0);
      $table->integer('questions_count')->default(0);
      $table->integer('answers_count')->default(0);
      $table->integer('comments_count')->default(0);
      $table->integer('favorites_count')->default(0);
      $table->integer('likes_count')->default(0);
      $table->integer('followers_count')->default(0);
      $table->integer('followings_count')->default(0);
      $table->string('api_token', 64)->unique();
      // 注意这里需要mysql5.7以上 支持json格式
      $table->json('settings')->nullable();
      $table->rememberToken();
      $table->timestamps();
    });
  }
  1. 执行 php artisan migrate 生成user table