ReflectionException - Class 名称在 Laravel 5.0 中不存在
ReflectionException - Class name does not exist in Laravel 5.0
我在尝试植入我的评论时遇到了一点问题 table。
我 100% 确定我 有 Class CommentTableSeeder.php
在我的 /database/seeds
目录中。
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
我不断收到
我也试过 运行ning composer update
和 运行 : php artisan db:seed
- 仍然得到相同的结果。
任何提示/帮助将不胜感激!
你需要运行
composer dump-autoload
修复此错误。除其他事项外,它的作用是刷新您的应用程序可用的 classes 列表。
在这种情况下,虽然 class 确实存在于正确的位置,但它在您自动加载的 class 列表中不可用,因此返回 Not Found
错误。
我在尝试植入我的评论时遇到了一点问题 table。
我 100% 确定我 有 Class CommentTableSeeder.php
在我的 /database/seeds
目录中。
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
我不断收到
我也试过 运行ning composer update
和 运行 : php artisan db:seed
- 仍然得到相同的结果。
任何提示/帮助将不胜感激!
你需要运行
composer dump-autoload
修复此错误。除其他事项外,它的作用是刷新您的应用程序可用的 classes 列表。
在这种情况下,虽然 class 确实存在于正确的位置,但它在您自动加载的 class 列表中不可用,因此返回 Not Found
错误。