【发布时间】:2015-08-04 13:25:51
【问题描述】:
我在尝试为我的 cmets 表播种时遇到了一点问题。
我 100% 确定我的/database/seeds 目录中拥有 Class CommentTableSeeder.php。
CommentTableSeeder.php
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class CommentTableSeeder extends Seeder {
public function run()
{
DB::table('comments')->delete();
Comment::create(array(
'author' => 'Chris Sevilleja',
'text' => 'Look I am a test comment.'
));
Comment::create(array(
'author' => 'Nick Cerminara',
'text' => 'This is going to be super crazy.'
));
Comment::create(array(
'author' => 'Holly Lloyd',
'text' => 'I am a master of Laravel and Angular.'
));
}
}
然后当我运行时:php artisan db:seed
我一直在得到
我也尝试运行 composer update 并运行:php artisan db:seed - 仍然得到相同的结果。
任何提示/帮助将不胜感激!
【问题讨论】:
-
在尝试此操作之前您是否运行过
composer dump-autoload? -
还没有,好的。我现在就做。
-
现在工作。非常感谢您的帮助。 :)
-
没问题,将其添加为完成的答案。
-
当然。大胆试试吧。我一定会接受的。
标签: php laravel laravel-5 seeding