Skip to content
Advertisement

Laravel 5: php artisan migrate:refresh

I am working on a laravel project and each time I change my table (add or remove column) and run php artisan migrate:refresh. I get this error:

[SymfonyComponentDebugExceptionFatalErrorException] Can’t use method return value in write context

Solution tried:

  1. run composer dump-autoload (Fails)
  2. Drop table in database, delete the migration file and restart again (works)

Previous migration file:

JavaScript

Changed migration file:

JavaScript

I added the user_id in the change file in the up function

Advertisement

Answer

Try this command it works for me

JavaScript

However, be careful! This command will drop all data from your DB:

Note: The migrate:fresh command will drop all tables from the database and then execute the migrate command.

as per Laravel docs.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement