【问题标题】:Laravel 5.1 ReflectionException Class does not exist [duplicate]Laravel 5.1 ReflectionException 类不存在[重复]
【发布时间】:2016-02-28 15:46:30
【问题描述】:

我们正在团队合作开展一个 laravel 项目,当我尝试运行时,我已经参与了我的队友的工作

"php artisan migrate:refresh --seed"

我收到这个奇怪的错误:

[ReflectionException] 
Class ColorsTableSeeder does not exist

ColorsTableSeeder 文件确实存在,所以我不知道为什么会出现此错误 ColorsTableSeeder:

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class ColorsTableSeeder extends Seeder
  {
    public function run()
    {
      DB::table('colors')->delete();
      $colorPalette = array('#000000','#663300', '#424153', '#999999', '#996633'); 
      $faker = Faker\Factory::create();
      $projects = App\Project::all(); //10

      foreach ($projects as $project)
      {
        foreach (range(1, 3) as $index) 
        {
            $project_id = $project['id'];
            DB::table('colors')->insert([
            'project_id' => $project_id,
            'color' => $faker->unique()->randomElement($colorPalette),
            ]);
        }
      // Reset
      $faker->unique(true);
      }
  }
}

【问题讨论】:

标签: php database laravel laravel-5 laravel-5.1


【解决方案1】:

通过以下方式修复它:

作曲家转储自动加载

【讨论】:

    猜你喜欢
    • 2015-08-05
    • 2015-12-05
    • 2014-01-24
    • 2022-10-25
    • 1970-01-01
    • 2017-04-03
    • 2019-11-14
    • 2021-05-31
    • 2020-03-17
    相关资源
    最近更新 更多