如何修复“方法Illuminate \ Database \ Schema \ Blueprint :: class不存在”。

时间:2019-04-16 13:01:44

标签: laravel migration

当我使用php artisan migration时,会收到此消息。 有人可以帮我弄这个吗? 我在互联网上进行搜索,但找不到任何对我有帮助的东西。 (我是laravel的新手)

我的桌子:

<?php

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

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

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

2 个答案:

答案 0 :(得分:1)

$ table-> class ('class'); //类不是type。

答案 1 :(得分:0)

$ table-> class ('class'); class 不是数据类型,请根据需要使用String,char或其他数据类型。使用以下链接获取Laravel中的数据类型参考

Datatype reference

相关问题