我的播种机类代码如下:
<?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]);
}
}
}
当我尝试在 CLI 上使用以下命令对其进行播种时:
php工匠数据库:种子
没有任何错误发生。这可能有什么问题?我在Github上看到了类似的讨论,但没有找到解决方案。您的帮助将不胜感激。