参考:https://www.cnblogs.com/aipiaoborensheng/p/9254364.html

先新建/app/Console/Commands/CollectInfo.php这个文件
或者php artisan make:console CollectInfo

<?php

namespace App\Console\Commands; /**

  • Created by wt.
  • User: Administrator
  • Date: 2019/1/2
  • Time: 16:59 */

use App\Http\Model\User; use Illuminate\Console\Command;

class CollectInfo extends Command { protected $name = 'collect:info'; protected $description = '描述一下吧';

public function __construct()
{
    parent::__construct();
}

public function handle()
{
    $user = new User();
    $user-&gt;name = '大哥';
    $user-&gt;age = 33;
    $user-&gt;save();

    echo "&lt;pre&gt;";
    print_r('haole');die;
}

}

然后执行php artisan collect:info这样就插入成功啦

Parse error: syntax error, unexpected T_VARIABLE报这个错
其实就是我的php7.0不够了,laravel5.5要7.1的了