for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMovieEarningsTable 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() {
DB::transaction(function () {
Schema::create('movie_earnings', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('movie_id');
$table->date('date');
$table->unsignedBigInteger('domestic')->nullable();
$table->unsignedBigInteger('worldwide')->nullable();
$table->timestamps();
$table->foreign('movie_id')->references('id')->on('movies')->onUpdate('cascade')->onDelete('cascade');
});
Schema::table('movies', function (Blueprint $table) {
$table->foreign('latest_earnings_id')->references('id')->on('movie_earnings')->onUpdate('set null')
->onDelete('cascade');
}
* Reverse the migrations.
public function down() {
$table->dropForeign('movies_latest_earnings_id_foreign');
Schema::drop('movie_earnings');
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.