Morning All
I was wondering if i could pick your brains on how best to lay out a section of a site i'm working on.
Essentially, there are users and admins to which users can submit a form to order software.
Users can login, purchase software files (t_files table) however there are around 11 options they can select in relation to the software. . (Im guessing these would be best on their own table?)
From this i also would like to generate an invoice at the time when the user submits the file request.
I was just wondering how best to lay this out in regards to foreign keys etc.
Also later down the line for reporting admin would like to pull the above stats etc based on the user. i.e how many files they have remapped, invoices against that user etc etc.
From the above, i'm guessing i would have 3 tables:-
Schema::create('t_files', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('dealer_id'); // This would be filled by the session id of the user unless there's a better way?
$table->string('');
$table->string('');
$table->string('');
$table->string('');
$table->string('');
$table->timestamps();
Schema::create('t_files_options', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('t_files_id');
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->boolean->('')->isnullable();
$table->foreign('t_files_id')->references('id')->on('t_files')->onDelete('cascade');
Schema::create('t_files_invoices', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('t_files_id');
$table->foreign('t_files_id')->references('id')->on('t_files')->onDelete('cascade');
Thank you in advance all.