Im my routes.php I have the following content:
<?php
Route::group(array(), function () {
View::share('roots', Category::roots()->get());
$tree = Category::get()->toHierarchy()->toArray();
View::share('categories', $tree);
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@index'));
});
When my database has no tables yet and I want to do php artisan migrate the result is: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ae_dev.categories' doesn't exist
My migration file:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::create('categories', function(Blueprint $table) {
$table->increments('id');
$table->integer('parent_id')->nullable()->index();
$table->integer('lft')->nullable()->index();
$table->integer('rgt')->nullable()->index();
$table->integer('depth')->nullable();
$table->string('name', 255);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::drop('categories');
}
}
I think that Laravel tray to call Category from routes.php and want to do select or somethink so I want to run the migration which creates categories table, but the above error is produced before...
How can I fix this?