I've created a migration for CreateUserTable successfully. <?php
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration;
class CreateUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user', function(Blueprint $table)
{
$table->increments('id');
$table->string('email')->unique;
$table->string('password', 60);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('user');
}
}
but I'm not able to rollback:
$ php artisan migrate:rollback
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'CreateUserTable' not found","file":"C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php","line":301}}
Someone suggested to run below but it give me an other error:
$ composer dump-autoload
Composer could not find the config file: C:\ProgramData\ComposerSetup\bin To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Any solution to rollback and avoid this second error related to composer.json? I'[m using Laravel 4 with fresh installation.
I would have suggested that same command. In my experience, errors from migrations like come from the composer autoloader in your project. Usually dumping autoloader will rebuild with the new class names added. Also be sure you haven't renamed the file where it doesn't match the class name.
Run
php artisan optimize
and try again.
I've resolved the issues by running the below command:
COMPOSER=composer.json composer dump-autoload
What does COMPOSER=composer.json mean???
You need to first navigate to your project folder, THEN run composer dump-autoload.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community