@@ -18,23 +18,23 @@ |
||
| 18 | 18 | public function rules(): array |
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | - 'number' => ['required', 'string', 'max:60', 'unique:invoices,number'], |
|
| 22 | - 'date' => ['required', 'date'], |
|
| 23 | - 'customer_name' => ['required', 'string', 'max:120'], |
|
| 24 | - 'customer_tax_id' => ['required', 'string', 'max:20'], |
|
| 25 | - 'customer_country' => ['nullable', 'string', 'size:2'], |
|
| 26 | - 'issuer_name' => ['required', 'string', 'max:120'], |
|
| 27 | - 'issuer_tax_id' => ['required', 'string', 'max:20'], |
|
| 28 | - 'issuer_country' => ['nullable', 'string', 'size:2'], |
|
| 29 | - 'amount' => ['required', 'numeric', 'min:0'], |
|
| 30 | - 'tax' => ['required', 'numeric', 'min:0'], |
|
| 31 | - 'total' => ['required', 'numeric', 'min:0'], |
|
| 32 | - 'type' => ['required', Rule::in(array_column(InvoiceType::cases(), 'value'))], |
|
| 33 | - 'external_reference' => ['nullable', 'string', 'max:60'], |
|
| 34 | - 'description' => ['nullable', 'string', 'max:500'], |
|
| 35 | - 'status' => ['nullable', 'string', 'max:30'], |
|
| 36 | - 'issued_at' => ['nullable', 'date'], |
|
| 37 | - 'cancelled_at' => ['nullable', 'date'], |
|
| 21 | + 'number' => [ 'required', 'string', 'max:60', 'unique:invoices,number' ], |
|
| 22 | + 'date' => [ 'required', 'date' ], |
|
| 23 | + 'customer_name' => [ 'required', 'string', 'max:120' ], |
|
| 24 | + 'customer_tax_id' => [ 'required', 'string', 'max:20' ], |
|
| 25 | + 'customer_country' => [ 'nullable', 'string', 'size:2' ], |
|
| 26 | + 'issuer_name' => [ 'required', 'string', 'max:120' ], |
|
| 27 | + 'issuer_tax_id' => [ 'required', 'string', 'max:20' ], |
|
| 28 | + 'issuer_country' => [ 'nullable', 'string', 'size:2' ], |
|
| 29 | + 'amount' => [ 'required', 'numeric', 'min:0' ], |
|
| 30 | + 'tax' => [ 'required', 'numeric', 'min:0' ], |
|
| 31 | + 'total' => [ 'required', 'numeric', 'min:0' ], |
|
| 32 | + 'type' => [ 'required', Rule::in(array_column(InvoiceType::cases(), 'value')) ], |
|
| 33 | + 'external_reference' => [ 'nullable', 'string', 'max:60' ], |
|
| 34 | + 'description' => [ 'nullable', 'string', 'max:500' ], |
|
| 35 | + 'status' => [ 'nullable', 'string', 'max:30' ], |
|
| 36 | + 'issued_at' => [ 'nullable', 'date' ], |
|
| 37 | + 'cancelled_at' => [ 'nullable', 'date' ], |
|
| 38 | 38 | ]; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | public function rules(): array |
| 17 | 17 | { |
| 18 | 18 | return [ |
| 19 | - 'invoice_id' => ['required', 'exists:invoices,id'], |
|
| 20 | - 'name' => ['required', 'string', 'max:120'], |
|
| 21 | - 'tax_id' => ['required', 'string', 'max:20'], |
|
| 22 | - 'country' => ['nullable', 'string', 'size:2'], |
|
| 23 | - 'address' => ['nullable', 'string', 'max:255'], |
|
| 24 | - 'email' => ['nullable', 'email', 'max:120'], |
|
| 25 | - 'phone' => ['nullable', 'string', 'max:30'], |
|
| 26 | - 'type' => ['nullable', 'string', 'max:10'], |
|
| 19 | + 'invoice_id' => [ 'required', 'exists:invoices,id' ], |
|
| 20 | + 'name' => [ 'required', 'string', 'max:120' ], |
|
| 21 | + 'tax_id' => [ 'required', 'string', 'max:20' ], |
|
| 22 | + 'country' => [ 'nullable', 'string', 'size:2' ], |
|
| 23 | + 'address' => [ 'nullable', 'string', 'max:255' ], |
|
| 24 | + 'email' => [ 'nullable', 'email', 'max:120' ], |
|
| 25 | + 'phone' => [ 'nullable', 'string', 'max:30' ], |
|
| 26 | + 'type' => [ 'nullable', 'string', 'max:10' ], |
|
| 27 | 27 | ]; |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -20,17 +20,17 @@ |
||
| 20 | 20 | public function rules(): array |
| 21 | 21 | { |
| 22 | 22 | return [ |
| 23 | - 'invoice_id' => ['required', 'exists:invoices,id'], |
|
| 24 | - 'tax_type' => ['required', Rule::in(array_column(TaxType::cases(), 'value'))], |
|
| 25 | - 'regime_type' => ['required', Rule::in(array_column(RegimeType::cases(), 'value'))], |
|
| 26 | - 'operation_type' => ['required', Rule::in(array_column(OperationType::cases(), 'value'))], |
|
| 27 | - 'tax_rate' => ['required', 'numeric', 'min:0'], |
|
| 28 | - 'base_amount' => ['required', 'numeric', 'min:0'], |
|
| 29 | - 'tax_amount' => ['required', 'numeric', 'min:0'], |
|
| 30 | - 'equivalence_surcharge_rate' => ['nullable', 'numeric', 'min:0'], |
|
| 31 | - 'equivalence_surcharge_amount' => ['nullable', 'numeric', 'min:0'], |
|
| 32 | - 'exemption_code' => ['nullable', 'string', 'max:5'], |
|
| 33 | - 'exemption_description' => ['nullable', 'string', 'max:255'], |
|
| 23 | + 'invoice_id' => [ 'required', 'exists:invoices,id' ], |
|
| 24 | + 'tax_type' => [ 'required', Rule::in(array_column(TaxType::cases(), 'value')) ], |
|
| 25 | + 'regime_type' => [ 'required', Rule::in(array_column(RegimeType::cases(), 'value')) ], |
|
| 26 | + 'operation_type' => [ 'required', Rule::in(array_column(OperationType::cases(), 'value')) ], |
|
| 27 | + 'tax_rate' => [ 'required', 'numeric', 'min:0' ], |
|
| 28 | + 'base_amount' => [ 'required', 'numeric', 'min:0' ], |
|
| 29 | + 'tax_amount' => [ 'required', 'numeric', 'min:0' ], |
|
| 30 | + 'equivalence_surcharge_rate' => [ 'nullable', 'numeric', 'min:0' ], |
|
| 31 | + 'equivalence_surcharge_amount' => [ 'nullable', 'numeric', 'min:0' ], |
|
| 32 | + 'exemption_code' => [ 'nullable', 'string', 'max:5' ], |
|
| 33 | + 'exemption_description' => [ 'nullable', 'string', 'max:255' ], |
|
| 34 | 34 | ]; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public static function sanitize(string $inputString): string |
| 16 | 16 | { |
| 17 | 17 | $trimmedString = trim($inputString); |
| 18 | - $sanitizedString = str_replace(['&', '<'], ['&', '<'], $trimmedString); |
|
| 18 | + $sanitizedString = str_replace([ '&', '<' ], [ '&', '<' ], $trimmedString); |
|
| 19 | 19 | return $sanitizedString; |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | return new class extends Migration { |
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | - Schema::create('breakdowns', function (Blueprint $table) { |
|
| 12 | + Schema::create('breakdowns', function(Blueprint $table) { |
|
| 13 | 13 | $table->id(); |
| 14 | 14 | $table->foreignId('invoice_id')->constrained('invoices')->onDelete('cascade'); |
| 15 | 15 | $table->string('tax_type', 5); // Enum TaxType |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | return new class extends Migration { |
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | - Schema::create('recipients', function (Blueprint $table) { |
|
| 12 | + Schema::create('recipients', function(Blueprint $table) { |
|
| 13 | 13 | $table->id(); |
| 14 | 14 | $table->foreignId('invoice_id')->constrained('invoices')->onDelete('cascade'); |
| 15 | 15 | $table->string('name', 120); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | return new class extends Migration { |
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | - Schema::create('invoices', function (Blueprint $table) { |
|
| 12 | + Schema::create('invoices', function(Blueprint $table) { |
|
| 13 | 13 | $table->id(); |
| 14 | 14 | $table->uuid('uuid')->unique(); |
| 15 | 15 | $table->string('number')->unique(); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | 'type' => $this->faker->randomElement(array_column(InvoiceType::cases(), 'value')), |
| 32 | 32 | 'external_reference' => $this->faker->optional()->bothify('EXT-####'), |
| 33 | 33 | 'description' => $this->faker->sentence, |
| 34 | - 'status' => $this->faker->randomElement(['draft', 'sent', 'paid', 'cancelled']), |
|
| 34 | + 'status' => $this->faker->randomElement([ 'draft', 'sent', 'paid', 'cancelled' ]), |
|
| 35 | 35 | 'issued_at' => $this->faker->optional()->dateTimeThisYear(), |
| 36 | 36 | 'cancelled_at' => null, |
| 37 | 37 | ]; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'address' => $this->faker->address, |
| 21 | 21 | 'email' => $this->faker->optional()->safeEmail, |
| 22 | 22 | 'phone' => $this->faker->optional()->phoneNumber, |
| 23 | - 'type' => $this->faker->optional()->randomElement(['VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED']), |
|
| 23 | + 'type' => $this->faker->optional()->randomElement([ 'VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED' ]), |
|
| 24 | 24 | ]; |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |