I have the following migration in my laravel migrations folder that i have already run:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAdminTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::create('Admin' , function($table){
$table->increments('id');
$table->mediumText('title');
$table->text('blog_content');
$table->char('tag' , 15);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::drop('Admin');
}
}
The above migration is for my admin table, what i would really like to do is add a foreign key in my admin table that is associated with my tags table. something like:
$table->foreign('tag')->references('tag')->on('tags');
How do i do this now that i have already run my migration ??
Thank you.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lCth3X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire