I'm building a laravel app that tracks projects. A user can define tasks and attach them to projects.
I'd like the user to be able to have a list of tasks that can be re-used for multiple projects. This is simple enough using a pivot table that links projects and tasks:
public function up()
{
Schema::create('project_task', function($table)
{
$table->increments('id');
$table->integer('project_id');
$table->integer('task_id');
$table->timestamps();
});
}
However, I'd like the user to be able to set different due dates for tasks depending on the project. So on project 1, Task A is due in one week. On project 2, Task A is due in a month.
What's the best table schema to store these type of values? Does there need to be another pivot table that links the task parameters to the project ID? I'm not sure how to handle this.
Thanks for your input.
EDIT: I'm using the Eloquent ORM, so the pivot rows are never really exposed, it just grabs the Task
object associated with the Project
.