1
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMenusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('menu', function (Blueprint $table) {
$table->increments('id');
$table->string('opcao');
$table->string('href');
$table->boolean('session');
$table->timestamps();
});
Schema::create('submenu', function (Blueprint $table) {
$table->increments('id');
$table->integer('submenu_id')->index;
$table->foreign('submenu_id')->references('id')->on('menu');
$table->string('opcao');
$table->string('href');
$table->boolean('ligado');
$table->timestamps();
});
}}
is giving wrong foreign key restriction error formed.
Someone can help me. This error occurs when running the command php artisan migrate
.
Dude I created your Migration in an application I already have, and it ran normally without errors. It can print the error that occurs or something like that?
– guastallaigor