0

I have this migration php file:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoriesTable.php extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function($table)
        {
            $table->increments('id'); 
            $table->string('name',200); 
            $table->string('description',200); 
            $table->boolean('is_disabled');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('categories');
    }

}

Then I executed php artisan migrate and got this error:

Fatal error: Illuminate\Filesystem\Filesystem::requireOnce(): Failed opening required 'WWW_DIRECTORY/app/database/migrations/2013_11_23_154547_cre ate_categories_table.php'

Aynone knows why this can be happening? I'm learning to use Laravel..

1 Answer 1

4

You are not declaring your class properly. That .php extension needs to be removed. Instead of

class CreateCategoriesTable.php extends Migration {

use

class CreateCategoriesTable extends Migration {

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks... It was an error in the name when I created by command line that class
It works! And don't forget to make sure your file doesn't have a trailing .php! create_categories_table.php.php...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.