【问题标题】:Why php artisan migrate fails: undefined method?为什么 php artisan migrate 失败:未定义的方法?
【发布时间】:2017-04-08 07:11:02
【问题描述】:

看这张图片:https://postimg.org/image/4fvu34juz/

当我运行 php artisan migrate 时,有显示:

[symfony\component\debug\exception\fatalthrowableerror]
call to undefined method illuminate\database\schema\blueprint::textarea<>

有什么办法可以解决我的问题吗?

更新:

代码:

<?php

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

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

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

【问题讨论】:

  • 请显示迁移。
  • @Alexey Mezenin,我更新了我的问题
  • 错误表示您正在尝试在某处使用textarea,因此您应该找到此迁移并将其展示给我们。
  • @Alexey Mezenin,已解决。我找到了。谢谢

标签: php laravel command-line command-prompt laravel-5.3


【解决方案1】:

这意味着在Blueprint 类中没有名为textarea() 的函数。删除调用它的代码。

【讨论】:

  • 您的迁移看起来不错,也许您的代码(另一个迁移脚本?)中的某个地方调用了 textarea()。也许你需要的是text() 方法。
  • 已解决。我找到了。谢谢
猜你喜欢
  • 2016-08-09
  • 2014-11-08
  • 2015-04-26
  • 2019-12-05
  • 2020-08-07
  • 2020-03-21
  • 1970-01-01
  • 2019-02-13
  • 2020-10-23
相关资源
最近更新 更多