您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2023_05_20_080131_create_taxes_table.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  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');
  16. $table->text('description')->nullable();
  17. $table->decimal('rate', 15, 4);
  18. $table->string('computation')->default('percentage'); // percentage, fixed, compound, inclusive, withholding
  19. $table->string('type')->default('sales'); // sales, purchases
  20. $table->string('scope')->nullable(); // product, service, none
  21. $table->boolean('enabled')->default(true);
  22. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  23. $table->timestamps();
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. */
  29. public function down(): void
  30. {
  31. Schema::dropIfExists('taxes');
  32. }
  33. };