laravel -> tinker

我用tinker生成测试数据,一直报错,我都是按照视频一步一步来的,求解。

PHP warning:  preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in D:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 747

详细代码如下:

/*create_lessons-table.php 创建表的migration*/

public function up(){    
    Schema::create('lessons', function (Blueprint $table) {        
    $table->increments('id');        
    $table->string('title');        
    $table->text('body');        
    $table->unsignedInteger('user_id');        
    $table->timestamps();   
 });}
/*ModelFactory.php*/


$factory->define(App\Lesson::class, function (Faker\Generator $faker) {    
    $userIds = \App\User::lists('id')->toArray(); 
    return [        
        'title' => $faker->title,        
        'body' => $faker->paragraph,        
        'user_id' =>$faker->randomElements($userIds)    
  ];
});
/*CMD*/

D:\wamp64\www\laraver>php artisan tinker
?[34mPsy Shell v0.7.2 (PHP 7.0.4 鈥?cli) by Justin Hileman?[39m

namespace App

=> ?[36mnull?[39m

factory(User::class, 20)->create()

....User数据....

factory(Lesson::class, 50)->create()

?[30;43mPHP warning:  preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in D:\wamp64\www\laraver\vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 747?[39
;49m
JellyBool
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
JellyBool
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
JellyBool
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!
JellyBool
修改的评论也不能少于六个字哦!
medivhzhan
修改的评论也不能少于六个字哦!