زمانی که میخوام migrate کنم با استفاده از کد php artisan migrate با ارور زیر مواجه میشم:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined function string()

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
@return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('post_id');
$table->string('commenter');
$table-string('email');
$table->text('comment');
$table->boolean('approved');
$table->timestamps();
});
}
/**

اگر لطف کنید کد خودتون رو داخل ``` اینا قرار بدید خیلی خوانا تر میشه ..
الان خیلی بهم ریختس
Sample code
کدهای خودتون رو بین دو تا از اینا ``` قرار بدید .
یعنی اول خط اون سه تا علامت (توجه کنید که سینگل کت نیستن ، اینی که شما گذاشتی خیر ''' ) رو قرار بدید و بعد کدها رو قرار بدید و سپس مجددا بعد از کدهاتون اون علامت رو قرار بدید .
موفق باشید
<?php
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class CreateCommentsTable extends Migration
{
/**
Run the migrations.
@return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('post_id');
$table->string('commenter');
$table-string('email');
$table->text('comment');
$table->boolean('approved');
$table->timestamps();
});
}
/**
Reverse the migrations.
@return void
*/
public function down()
{
Schema::drop('comments');
}
}دوسه جاشو اشتباه نوشته بودی دوست عزیز:
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class CreateCommentsTable extends Migration
{
/**
Run the migrations.
@return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('post_id')->unsigned();
$table->string('commenter');
$table->string('email');
$table->text('comment');
$table->boolean('approved');
$table->timestamps();
});
}
/**
Reverse the migrations.
@return void
*/
public function down()
{
Schema::dropIfExists('comments');
}
}