From bf5359cb723e68070a605f3c3bb084e7f058516c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Aug 2025 15:16:04 +1000 Subject: [PATCH] Add VerifactuLog --- app/Models/VerifactuLog.php | 41 ++++++++++++++++++ .../2025_08_07_045606_add_verifactu_table.php | 42 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 app/Models/VerifactuLog.php create mode 100644 database/migrations/2025_08_07_045606_add_verifactu_table.php diff --git a/app/Models/VerifactuLog.php b/app/Models/VerifactuLog.php new file mode 100644 index 0000000000..ca701437ae --- /dev/null +++ b/app/Models/VerifactuLog.php @@ -0,0 +1,41 @@ + 'date', + 'response' => 'object', + ]; + + public function company() + { + return $this->belongsTo(Company::class); + } + + public function invoice() + { + return $this->belongsTo(Invoice::class); + } +} diff --git a/database/migrations/2025_08_07_045606_add_verifactu_table.php b/database/migrations/2025_08_07_045606_add_verifactu_table.php new file mode 100644 index 0000000000..ea69bdc002 --- /dev/null +++ b/database/migrations/2025_08_07_045606_add_verifactu_table.php @@ -0,0 +1,42 @@ +id(); + $table->unsignedInteger('company_id')->index(); + $table->unsignedInteger('invoice_id')->index(); + + $table->string('nif'); + $table->string('date'); + $table->string('invoice_number'); + $table->string('hash'); + $table->string('previous_hash')->nullable(); + $table->string('status'); + + $table->json('response')->nullable();; + $table->timestamps(); + + $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); + $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade')->onUpdate('cascade'); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +};