Search code examples
laravellaravel-5laravel-validation

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 '$'

Here is my code

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();
            });
        }

Solution

  • $table->('userid')
    

    This is why you get a syntax error. It should probably be $table->integer('userid').