当我尝试迁移我的个人资料 table 时出现错误。我正在使用 laravel 5.1
when i try to migrate my profile table its giving me the error .i am using laravel 5.1
[Symfony\Component\Debug\Exception\FatalErrorException] syntax
error, unexpected '(', expecting identifier (T_STRING) or variable
(T_VARIABLE) or '{' or '$'
这是我的代码
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();
});
}
$table->('userid')
这就是您收到语法错误的原因。应该是$table->integer('userid')
.
[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
这是我的代码
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();
});
}
$table->('userid')
这就是您收到语法错误的原因。应该是$table->integer('userid')
.