我正在将 Laravel 准系统项目部署到 Microsoft Azure,但是每当我尝试执行php artisan migrate
我收到错误:
[2015-06-13 14:34:05] production.ERROR:异常“Symfony \ Component \ Debug \ Exception \ FatalErrorException”,消息“未找到”类“在D:\ home \ site \vendor \ laravel \framework中\src\Illuminate\Database\Migrations\Migrator.php:328
堆栈跟踪:
#0 {main}
可能是什么问题呢?非常感谢
- 编辑 -
移民等级
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('surname', 50);
$table->bigInteger('telephone');
$table->string('email', 50)->unique();
$table->string('username', 50)->unique();
$table->string('password', 50);
$table->boolean('active')->default(FALSE);
$table->string('email_confirmation_code', 6);
$table->enum('notify', ['y', 'n'])->default('y');
$table->rememberToken();
$table->timestamps();
$table->index('username');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
对于 PSR-4 自动加载器用户 (composer.json):
将迁移文件夹保留在里面classmap
数组,并且不要将其包含在下面的 psr-4 对象中autoload
头。由于迁移的主类 Migrator 不支持命名空间。例如;
"autoload": {
"classmap": [
"app/database/migrations"
],
"psr-4": {
"Acme\\controllers\\": "app/controllers"
}
}
然后运行:
php artisan clear-compiled
php artisan optimize:clear
composer dump-autoload
php artisan optimize
- 第一个清除所有已编译的自动加载文件。
- 第二次清除 Laravel 缓存(可选)
- 第三步为命名空间类构建自动加载器。
- Fourth 优化 Laravel 应用程序的各个部分,并为非命名空间类构建自动加载器。
从现在起,您将不必再次执行此操作,并且任何新的迁移都将正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)