Laravel开发实战 开发一个类知乎

基础设置

创建一个新laravel项目,其中zhihu-app是项目名称也是项目目录

截止目前laravel项目默人为5.5.* php要求7.1以上 

laravel new zhihu-app

如果你想指定laravel版本请用下列方式安装

composer create-project laravel/laravel zhihu-app 5.5.*

进入database/migrations/   create_users_table 文件

修改up方法

  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('avator');
            $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->json('settings')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

执行migrate命令

php artisan migrate

修改 config/app.php文件的timezone为PRC

用户注册

执行命令创建用户注册登录脚手架

php artisan make:auth


使用sendcloud发送用户email

到https://github.com/NauxLiu/Laravel-SendCloud 按照说明进行安装下载

转载于:https://my.oschina.net/lilugirl2005/blog/1632806

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值