@@ -33,9 +33,9 @@ |
||
| 33 | 33 | $base = self::getBaseUrl($production, $verifactuMode); |
| 34 | 34 | |
| 35 | 35 | $nif = $issuerVat; |
| 36 | - $numserie = (string) $invoice->getInvoiceNumber(); |
|
| 36 | + $numserie = (string)$invoice->getInvoiceNumber(); |
|
| 37 | 37 | $fecha = $invoice->getIssueDate()->format('d-m-Y'); |
| 38 | - $importe = number_format((float) $invoice->getTotalAmount(), 2, '.', ''); |
|
| 38 | + $importe = number_format((float)$invoice->getTotalAmount(), 2, '.', ''); |
|
| 39 | 39 | |
| 40 | 40 | $query = http_build_query([ |
| 41 | 41 | 'nif' => $nif, |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function up(): void |
| 20 | 20 | { |
| 21 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 21 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 22 | 22 | // CSV from AEAT |
| 23 | 23 | $table->string('csv', 16)->nullable()->index()->after('hash'); |
| 24 | 24 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function down(): void |
| 57 | 57 | { |
| 58 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 59 | - $table->dropIndex(['previous_invoice_number']); |
|
| 60 | - $table->dropIndex(['is_first_invoice']); |
|
| 61 | - $table->dropIndex(['rectificative_type']); |
|
| 62 | - $table->dropIndex(['csv']); |
|
| 58 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 59 | + $table->dropIndex([ 'previous_invoice_number' ]); |
|
| 60 | + $table->dropIndex([ 'is_first_invoice' ]); |
|
| 61 | + $table->dropIndex([ 'rectificative_type' ]); |
|
| 62 | + $table->dropIndex([ 'csv' ]); |
|
| 63 | 63 | |
| 64 | 64 | $table->dropColumn([ |
| 65 | 65 | 'csv', |
@@ -16,26 +16,26 @@ |
||
| 16 | 16 | { |
| 17 | 17 | Schema::table('invoices', function (Blueprint $table) { |
| 18 | 18 | $table->string('aeat_estado_registro', 30) |
| 19 | - ->nullable() |
|
| 20 | - ->after('csv') |
|
| 21 | - ->index() |
|
| 22 | - ->comment('AEAT registry status: Correcto, AceptadoConErrores, Incorrecto'); |
|
| 19 | + ->nullable() |
|
| 20 | + ->after('csv') |
|
| 21 | + ->index() |
|
| 22 | + ->comment('AEAT registry status: Correcto, AceptadoConErrores, Incorrecto'); |
|
| 23 | 23 | |
| 24 | 24 | $table->string('aeat_codigo_error', 20) |
| 25 | - ->nullable() |
|
| 26 | - ->after('aeat_estado_registro') |
|
| 27 | - ->comment('AEAT error code if rejected'); |
|
| 25 | + ->nullable() |
|
| 26 | + ->after('aeat_estado_registro') |
|
| 27 | + ->comment('AEAT error code if rejected'); |
|
| 28 | 28 | |
| 29 | 29 | $table->text('aeat_descripcion_error') |
| 30 | - ->nullable() |
|
| 31 | - ->after('aeat_codigo_error') |
|
| 32 | - ->comment('AEAT error description if rejected'); |
|
| 30 | + ->nullable() |
|
| 31 | + ->after('aeat_codigo_error') |
|
| 32 | + ->comment('AEAT error description if rejected'); |
|
| 33 | 33 | |
| 34 | 34 | $table->boolean('has_aeat_warnings') |
| 35 | - ->default(false) |
|
| 36 | - ->after('aeat_descripcion_error') |
|
| 37 | - ->index() |
|
| 38 | - ->comment('Indicates if invoice has AEAT warnings'); |
|
| 35 | + ->default(false) |
|
| 36 | + ->after('aeat_descripcion_error') |
|
| 37 | + ->index() |
|
| 38 | + ->comment('Indicates if invoice has AEAT warnings'); |
|
| 39 | 39 | }); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function up(): void |
| 16 | 16 | { |
| 17 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 17 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 18 | 18 | $table->string('aeat_estado_registro', 30) |
| 19 | 19 | ->nullable() |
| 20 | 20 | ->after('csv') |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function down(): void |
| 43 | 43 | { |
| 44 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 45 | - $table->dropIndex(['aeat_estado_registro']); |
|
| 46 | - $table->dropIndex(['has_aeat_warnings']); |
|
| 44 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 45 | + $table->dropIndex([ 'aeat_estado_registro' ]); |
|
| 46 | + $table->dropIndex([ 'has_aeat_warnings' ]); |
|
| 47 | 47 | |
| 48 | 48 | $table->dropColumn([ |
| 49 | 49 | 'aeat_estado_registro', |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function up(): void |
| 22 | 22 | { |
| 23 | - Schema::table('recipients', function (Blueprint $table) { |
|
| 23 | + Schema::table('recipients', function(Blueprint $table) { |
|
| 24 | 24 | $table->string('id_type', 2)->nullable()->after('country') |
| 25 | 25 | ->comment('ID type for foreign recipients: 02=NIF-IVA, 03=Passport, 04=Official doc, 05=Tax residence cert, 06=Other, 07=Not registered'); |
| 26 | 26 | }); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function down(): void |
| 30 | 30 | { |
| 31 | - Schema::table('recipients', function (Blueprint $table) { |
|
| 31 | + Schema::table('recipients', function(Blueprint $table) { |
|
| 32 | 32 | $table->dropColumn('id_type'); |
| 33 | 33 | }); |
| 34 | 34 | } |
@@ -22,23 +22,23 @@ |
||
| 22 | 22 | return new class extends Migration { |
| 23 | 23 | public function up(): void |
| 24 | 24 | { |
| 25 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 25 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 26 | 26 | // Index for queries by issuer (client) |
| 27 | 27 | $table->index('issuer_tax_id', 'invoices_issuer_tax_id_index'); |
| 28 | 28 | |
| 29 | 29 | // Composite index for "invoices from a client with status X" |
| 30 | 30 | // Very used in: dashboards, reports, retries |
| 31 | - $table->index(['issuer_tax_id', 'date'], 'invoices_issuer_date_index'); |
|
| 31 | + $table->index([ 'issuer_tax_id', 'date' ], 'invoices_issuer_date_index'); |
|
| 32 | 32 | |
| 33 | 33 | // Index for chaining search (previous invoice) |
| 34 | 34 | // Chaining must search only invoices from the same issuer |
| 35 | - $table->index(['issuer_tax_id', 'previous_invoice_number'], 'invoices_issuer_prev_number_index'); |
|
| 35 | + $table->index([ 'issuer_tax_id', 'previous_invoice_number' ], 'invoices_issuer_prev_number_index'); |
|
| 36 | 36 | }); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function down(): void |
| 40 | 40 | { |
| 41 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 41 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 42 | 42 | $table->dropIndex('invoices_issuer_tax_id_index'); |
| 43 | 43 | $table->dropIndex('invoices_issuer_date_index'); |
| 44 | 44 | $table->dropIndex('invoices_issuer_prev_number_index'); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function up(): void |
| 16 | 16 | { |
| 17 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 17 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 18 | 18 | $table->string('customer_name', 120)->nullable()->change(); |
| 19 | 19 | $table->string('customer_tax_id', 20)->nullable()->change(); |
| 20 | 20 | }); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function down(): void |
| 24 | 24 | { |
| 25 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 25 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 26 | 26 | $table->string('customer_name', 120)->nullable(false)->change(); |
| 27 | 27 | $table->string('customer_tax_id', 20)->nullable(false)->change(); |
| 28 | 28 | }); |
@@ -24,18 +24,18 @@ |
||
| 24 | 24 | return new class extends Migration { |
| 25 | 25 | public function up(): void |
| 26 | 26 | { |
| 27 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 27 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 28 | 28 | // Drop the unique index by number only |
| 29 | - $table->dropUnique(['number']); |
|
| 29 | + $table->dropUnique([ 'number' ]); |
|
| 30 | 30 | |
| 31 | 31 | // Create composite unique index (issuer_tax_id + number) |
| 32 | - $table->unique(['issuer_tax_id', 'number'], 'invoices_issuer_number_unique'); |
|
| 32 | + $table->unique([ 'issuer_tax_id', 'number' ], 'invoices_issuer_number_unique'); |
|
| 33 | 33 | }); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function down(): void |
| 37 | 37 | { |
| 38 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 38 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 39 | 39 | // Revert: drop composite index |
| 40 | 40 | $table->dropUnique('invoices_issuer_number_unique'); |
| 41 | 41 | |
@@ -17,9 +17,9 @@ |
||
| 17 | 17 | { |
| 18 | 18 | Schema::table('invoices', function (Blueprint $table) { |
| 19 | 19 | $table->string('numero_instalacion', 100) |
| 20 | - ->nullable() |
|
| 21 | - ->after('issuer_tax_id') |
|
| 22 | - ->comment('Unique installation number for VERIFACTU (max 100 chars per AEAT XSD). Format: CIF-001'); |
|
| 20 | + ->nullable() |
|
| 21 | + ->after('issuer_tax_id') |
|
| 22 | + ->comment('Unique installation number for VERIFACTU (max 100 chars per AEAT XSD). Format: CIF-001'); |
|
| 23 | 23 | }); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function up(): void |
| 17 | 17 | { |
| 18 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 18 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 19 | 19 | $table->string('numero_instalacion', 100) |
| 20 | 20 | ->nullable() |
| 21 | 21 | ->after('issuer_tax_id') |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function down(): void |
| 27 | 27 | { |
| 28 | - Schema::table('invoices', function (Blueprint $table) { |
|
| 28 | + Schema::table('invoices', function(Blueprint $table) { |
|
| 29 | 29 | $table->dropColumn('numero_instalacion'); |
| 30 | 30 | }); |
| 31 | 31 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | return new class extends Migration { |
| 20 | 20 | public function up(): void |
| 21 | 21 | { |
| 22 | - Schema::table('breakdowns', function (Blueprint $table) { |
|
| 22 | + Schema::table('breakdowns', function(Blueprint $table) { |
|
| 23 | 23 | $table->decimal('tax_rate', 6, 2)->nullable()->change(); |
| 24 | 24 | $table->decimal('tax_amount', 15, 2)->nullable()->change(); |
| 25 | 25 | }); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function down(): void |
| 29 | 29 | { |
| 30 | - Schema::table('breakdowns', function (Blueprint $table) { |
|
| 30 | + Schema::table('breakdowns', function(Blueprint $table) { |
|
| 31 | 31 | $table->decimal('tax_rate', 6, 2)->nullable(false)->change(); |
| 32 | 32 | $table->decimal('tax_amount', 15, 2)->nullable(false)->change(); |
| 33 | 33 | }); |