1
Я работаю над проектом laravel и каждый раз, когда я меняю свой стол (добавляю или удаляю столбцы) и запускаю php artisan migrate:refresh
. Я получаю эту ошибку:Laravel 5: php artisan migrate: обновить
[Symfony\Component\Debug\Exception\FatalErrorException] Can't use method return value in write context
Решение пытался:
- пробег
composer dump-autoload
(не получится) - отброшенных таблицы в базе данных, удалите файл миграции и перезагрузки снова (работы)
Предыдущий файл миграции:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
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');
$table->string('body');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comments');
}
}
Измененной миграция файл:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->integer('post_id');
$table->string('body');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comments');
}
}
Я добавил user_id в файле изменений в вверх функциях
Вы, кажется, есть проблема в вашей миграции код. Можете ли вы разместить содержимое файла миграции? – ubuntus
сделано :) Спасибо за помощь –