for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCategorizableTable extends Migration
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
$connection = config('categorizable.connection');
Schema::connection($connection)->create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->nestedSet();
$table->timestamps();
});
Schema::connection($connection)->create('categorizable', function (Blueprint $table) {
$table->unsignedInteger('category_id');
$table->nullableMorphs('categorizable');
$table->index('categorizable_type', 'categorizable_id');
}
* Reverse the migrations.
public function down()
if (Schema::connection($connection)->hasTable('categories')) {
Schema::connection($connection)->drop('categories');
if (Schema::connection($connection)->hasTable('categorizable')) {
Schema::connection($connection)->drop('categorizable');
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.