调用未定义的方法Illuminate \ Support \ Facades \ Event :: newCollection()

时间:2017-09-25 23:00:12

标签: php laravel laravel-5 lumen

在lumen5.5中我实现了我的工厂方法

$factory->define(App\CollegeEvent::class, function (Faker\Generator $faker) {
    return [
        'name' => randomElement(["Event1","Event2","Event4","Event3",]),
        'slug' => $faker->email,
        'category'=>randomElement(["Cat1","Cat2","Cat4","Cat3",]),
        'problem_statement'=>$faker->paragraph(),
        'description'=>$faker->paragraph(),
        'name1'=>$faker->name,
        'email1'=>$faker->email,
        'contact1'=>$faker->address,
        'name2'=>$faker->name,
        'email2'=>$faker->email,
        'contact2'=>$faker->address,
        'faculty'=>$faker->name,
    ];
}); 

表蓝色打印的up()方法也是这样的

  public function up()
    {
        Schema::create('event', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug');
            $table->string('category');
            $table->string('problem_statement'); //problem statement for event
            $table->text('description');
            $table->string('name1'); //cordinator1
            $table->string('email1');
            $table->string('contact1',13);
            $table->string('name2');//cordinator2
            $table->string('email2');
            $table->string('contact2',13);
            $table->string('faculty');
            $table->integer('count')->default(0);
            $table->timestamps();

        });
    }

在DatabaseSeeder.php中我有

class DatabaseSeeder extends Seeder
{
    public function run()
    {
        factory(CollegeEvent::class,10)->create();

    }
}

我不知道这些事情是否对此错误很重要,但我在运行时遇到以下错误

php artisan db:seed


    [Symfony\Component\Debug\Exception\FatalThrowableError]                     
 Call to undefined methodIlluminate\Support\Facades\Event::newCollection()

0 个答案:

没有答案