【问题标题】:Laravel migration error: Base table or view not foundLaravel 迁移错误:找不到基表或视图
【发布时间】:2021-09-24 19:30:23
【问题描述】:

我收到以下错误。我该如何解决?

未找到基表或视图:1146 表“account_infos”

迁移

public function up()
{
    Schema::create('account_info', function (Blueprint $table) {
        $table->id();
        $table->unsignedBigInteger('users_id');
        $table->foreign('users_id')->references('id')
            ->on('users')->onDelete('cascade');
        $table->unsignedBigInteger('axis_id');
        $table->foreign('axis_id')->references('id')
            ->on('axis')->onDelete('cascade');
        $table->enum('account_type',['legal','rightful']);
        $table->timestamps();
    });
}

【问题讨论】:

  • 您是否还有其他引用 account_infos 的迁移?
  • 在运行迁移或使用路由或..时是否收到错误?
  • 迁移成功,但在我尝试调用表单时出现错误消息

标签: php laravel laravel-migrations


【解决方案1】:

只需添加:

    protected $table='account_info';

在你的模型中

【讨论】:

  • 他说错误在于迁移,而不是模型。至少他是这么说的!但我认为你是对的,他不知道他面临的问题在哪里!!
猜你喜欢
  • 2019-06-09
  • 2015-05-24
  • 2016-04-16
  • 2020-03-13
  • 2019-08-21
  • 1970-01-01
  • 2016-06-21
  • 2019-12-30
  • 1970-01-01
相关资源
最近更新 更多