Hello, when i typed command php artisan migrate:rollback i got error, that class does not exist. But it is existing.
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateWebsiteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('website', function (Blueprint $table) {
$table->increments('id_site');
$table->string('');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('website');
}
}
using folders for migration table organization and testing.
had undefined index problem as above. composer dump-autload, deleting migrations table, restarting vagrant, lots of other attempts all failed.
simple solution: on php artisan migrate:rollback --path=/database/migrations/folder
pass the path parameter to the rollback method. that's the solution if composer dump-autoload doesn't work for you on rollback or reset due to undefined index error.
composer dump-autoload alone did not worked for me.
if you happen to rename your classes and did it without using the terminal, you need to check the autoload-static.php and autoload-classmap.php for the Migration name and its corresponding migration table.
Ex.
CreateEmpTable => {date}_create_emps_table. is giving me an error since Emp is singular while emps is plural. This caused my error. so I simply change them in the specified files and then run composer dump-autoload. then migrate.