Hi at all,
i need help to design the database. So in the first step i want price templates for each account. So i've now a table for the templates with name, created_at, e.g. and another table with the values of the pricing templates.
Schema::create('pricing_templates', function (Blueprint $table) {
$table->increments('id')->primary();
$table->string('name');
});
Schema::create('pricing_template_values', function (Blueprint $table) {
$table->increments('id')->primary();
$table->int('pricing_templates_id')->unsigned();
$table->string('name');
$table->float('price');
});
But now i want to set custom values to the prices per user account. And at this step i dont know how it is the best solution. Can anyone help me?
You add a user_id column to pricing_template_values.
You create a pivot table to link users and pricing_template_values (many-to-many relationship).
I can't say which is best for your need. If the name in pricing_template_values is the different for each user, the first solution is fine. Otherwise the second one will be more flexible (but also a bit more complicated to manage).