This question already has an answer here:
We are working in team on a laravel project and I've pulled in my teammates work and when I try to run
"php artisan migrate:refresh --seed"
I get this weird error:
[ReflectionException]
Class ColorsTableSeeder does not exist
The file ColorsTableSeeder does exist so I have no idea why I get this error 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);
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire