Reputation: 2787
My seeder Class code is as follows:
<?php
use App\Category;
use Illuminate\Database\Seeder;
class CategoryTableSeeder extends Seeder
{
public function run()
{
DB::table('categories')->delete();
$cats = ['math', 'physics', 'calculus', 'eletronics', 'etc etc'];
foreach ($cats as $cat)
{
Category::create(['category' => $cat]);
}
}
}
When I try to seed it using the following command on CLI:
php artisan db:seed
Nothing happens with no error. What might be wrong with this? I am seeing similar discussion on Github but finding no solution. Your help will be highly appreciated.
Upvotes: 0
Views: 586
Reputation: 13335
try php artisan db:seed --class=CategoryTableSeeder
If you want to always run this seed add $this->call('CategoryTableSeeder');
in the DatabaseSeeder
Upvotes: 1