这个问题已经解决了 - 我使用了以下方法:
并且,感谢 IRC 的帮助解决了我的问题。我被告知运行
php composer.phar dump-autoload
这对我解决了问题。很可能与我的奇怪的Composer设置有关。
我刚刚开始尝试使用Laravel 4进行可能的未来项目,之前使用过Laravel 3。我通过artisan创建了一个新的迁移create_blogs_table:
php artisan migrate:make create_blogs_table --table=blogs --create
这将生成基本的迁移文件结构,然后我会再填写一些内容:
<?php
use Illuminate\Database\Migrations\Migration;
class CreateBlogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blogs', function($table)
{
$table->increments('id');
$table->string('title');
$table->text('description')->nullable();
$table->integer('user_id')->unsigned();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blogs');
}
}
我现在尝试再次使用Artisan运行此迁移:
php artisan migrate --env=local
*注意,我已经为扩展名为.dev的域名设置了本地数据库连接
之前这个在 Laravel 3 中可以正常工作,但是在 Illuminate 中我会收到这个错误:
PHP Fatal error: Class 'CreateBlogsTable' not found in /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php on line 301
PHP Stack trace:
PHP 1. {main}() /var/www/gamingsite/artisan:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/gamingsite/artisan:57
PHP 3. Symfony\Component\Console\Application->doRun() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Application.php:106
PHP 4. Illuminate\Console\Command->run() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP 5. Symfony\Component\Console\Command\Command->run() /var/www/gamingsite/vendor/illuminate/console/src/Illuminate/Console/Command.php:95
PHP 6. Illuminate\Console\Command->execute() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
PHP 7. Illuminate\Database\Console\Migrations\MigrateCommand->fire() /var/www/gamingsite/vendor/illuminate/console/src/Illuminate/Console/Command.php:107
PHP 8. Illuminate\Database\Migrations\Migrator->run() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:69
PHP 9. Illuminate\Database\Migrations\Migrator->runMigrationList() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:75
PHP 10. Illuminate\Database\Migrations\Migrator->runUp() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:106
PHP 11. Illuminate\Database\Migrations\Migrator->resolve() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:125
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/gamingsite/app/start/../storage/logs/log-2012-12-28.txt" could not be opened: failed to open stream: Permission denied' in /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:71
Stack trace:
#0 /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(77): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array)
#2 /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Logger.php(214): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#3 /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Logger.php(278): Monolog\Logger->addRecord(400, Object(Symfony\Component\HttpKernel\Exception\FatalErrorException), Array)
#4 [internal function]: Monolog\Logger->addError(Object(Symfony\Component\HttpKernel\Exception\FatalErrorExcepti in /var/www/gamingsite/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 71
PHP Stack trace:
PHP 1. {main}() /var/www/gamingsite/artisan:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/gamingsite/artisan:57
PHP 3. Symfony\Component\Console\Application->doRun() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Application.php:106
PHP 4. Illuminate\Console\Command->run() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP 5. Symfony\Component\Console\Command\Command->run() /var/www/gamingsite/vendor/illuminate/console/src/Illuminate/Console/Command.php:95
PHP 6. Illuminate\Console\Command->execute() /var/www/gamingsite/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
PHP 7. Illuminate\Database\Console\Migrations\MigrateCommand->fire() /var/www/gamingsite/vendor/illuminate/console/src/Illuminate/Console/Command.php:107
PHP 8. Illuminate\Database\Migrations\Migrator->run() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:69
PHP 9. Illuminate\Database\Migrations\Migrator->runMigrationList() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:75
PHP 10. Illuminate\Database\Migrations\Migrator->runUp() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:106
PHP 11. Illuminate\Database\Migrations\Migrator->resolve() /var/www/gamingsite/vendor/illuminate/database/src/Illuminate/Database/Migrations/Migrator.php:125
我已经检查过,数据库/迁移/文件夹肯定被自动加载了。我不知道这个问题的原因是什么。在IRC上询问并谷歌搜索后,我仍然完全不知所措,希望有人能在这里帮助我。
提前致谢!
php composer.phar dump-autoload
解决了。 - Rob