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;
class CreateBlogTables 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()
Schema::create('BlogCategory', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 100);
$table->string('description', 250);
$table->timestamps();
$table->softDeletes();
$table->creation();
});
Schema::create('BlogPost', function (Blueprint $table) {
$table->string('title', 100);
$table->text('contents');
$table->integer('category')->unsigned();
$table->integer('author')->unsigned();
$table->integer('likes')->default(0);
$table->integer('shares')->default(0);
$table->integer('views')->default(0);
$table->string('keywords', 250);
$table->foreign('category')->references('id')->on('BlogCategory');
$table->foreign('author')->references('id')->on('User');
}
* Reverse the migrations.
public function down()
Schema::drop('BlogPost');
Schema::drop('BlogCategory');
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.