1
I am building an application using Laravel 5.1 and in my ER Diagram it is very deep and detailed (even with index nomenclature). I need to know how to create a Foreign Key using the Migration methods of the Laravel in which I can define the name of the same, maybe something like:
Schema::create('historico', function (Blueprint $table) {
    $table->increments('id');
    $table->dateTime('data_reg')
          ->default(DB::raw('CURRENT_TIMESTAMP'));
    $table->integer('usuario_id');
    $table->foreign('usuario_id')
          ->foreignName('historico$usuario_id') // <-- procuro isso aqui
          ->references('id')
          ->on('usuario')
          ->onDelete('CASCADE')
          ->onUpdate('CASCADE');
    $table->string('acao', 500);
    $table->longText('conteudo')->nullable();
});
						
If the answer solved the problem, please consider marking it. Then we will know that it was useful for you and will have a better view by the other user.
– Wallace Maxters