I was hoping to get a little input on my relationships. I have a simple migration like so
Schema::create('project_docs', function(Blueprint $table)
{
$table->increments('id');
$table->integer('projectId')->unsigned()->default(0);
$table->foreign('projectId')->references('id')->on('projects')->onDelete('cascade');
$table->longText('whatData');
$table->longText('whoData');
$table->timestamps();
});
Schema::create('projects', function (Blueprint $table) {
$table->increments('id');
$table->string('projectId')->default('');
$table->string('clientStatus')->default('');
$table->string('contactName')->default('');
$table->string('projectName')->default('');
$table->timestamps();
});
I was hoping that would produce a one to one relationship, but when I open the database within MySQL Workbench and display the EER diagram, it shows that projects can have one to many project_docs.
I know within their Models in Laravel I can define their one to one relationship, do I need to change the one to many relationship produced by the above or do I just ignore it?
Thanks
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KL1vuC
via IFTTT
Aucun commentaire:
Enregistrer un commentaire