当我尝试迁移我的个人资料表时,它给我错误。我正在使用laravel 5.1

时间:2015-07-03 07:48:12

标签: laravel laravel-5 laravel-validation

  

[Symfony \ Component \ Debug \ Exception \ FatalErrorException]语法   错误,意外'(',期待标识符(T_STRING)或变量   (T_VARIABLE)或'{'或'$'

这是我的代码

public function up()
        {
            Schema::create('profile', function (Blueprint $table) {
                $table->('userid')->unsigned()->default(0);
                $table->string('profile')->default('http://localhost/laravel/public/image/uzair.jpg');
                $table->string('about',255);
                $table->foreign('userid')->references('id')->on('users')->onDelete('cascade');
                $table->timestamps();
            });
        }

1 个答案:

答案 0 :(得分:4)

$table->('userid')

这就是您遇到语法错误的原因。应该是$table->integer('userid')