Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

2023_09_08_011045_create_taxes_table.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('taxes', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  15. $table->string('name')->index();
  16. $table->string('description')->nullable();
  17. $table->integer('rate')->default(0);
  18. $table->string('computation')->default('percentage');
  19. $table->string('type')->default('sales');
  20. $table->string('scope')->nullable();
  21. $table->boolean('enabled')->default(true);
  22. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  23. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  24. $table->timestamps();
  25. $table->unique(['company_id', 'name', 'type']);
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. */
  31. public function down(): void
  32. {
  33. Schema::dropIfExists('taxes');
  34. }
  35. };