【问题标题】:Class CreateTableName Not found php artisan类 CreateTableName 未找到 php artisan
【发布时间】:2015-08-20 12:24:38
【问题描述】:

当我输入控制台时 - php artisan make:migration create_website_table --create=website

比创建文件,我没有编辑任何东西并运行命令php artisan migrate

现在我想回滚它,它说

[Symfony\Component\Debug\Exception\FatalErrorException]
找不到类“CreateWebsiteTable”

我的迁移网站类的代码

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWebsiteTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('website', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('website');
    }
}

也许有一些命名空间?

【问题讨论】:

  • 尝试从 Laravel 项目的根目录运行“composer dump-autoload”

标签: php laravel laravel-5.1


【解决方案1】:

在运行php artisan migrate之前,运行以下代码 composer dump-autoload.

事实上,每当你得到ClassNotFound 异常,运行上面的命令!

【讨论】:

    猜你喜欢
    • 2017-10-13
    • 2017-10-04
    • 2018-11-10
    • 2020-03-23
    • 1970-01-01
    • 2015-05-20
    • 1970-01-01
    • 2022-06-23
    • 2020-07-24
    相关资源
    最近更新 更多