2025_03_29_223106_create_sales_table.php 699 B

123456789101112131415161718192021222324252627282930
  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('sales', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('employee_id')->constrained()->onDelete('cascade'); // Foreign key to employees
  15. $table->decimal('amount', 10, 2); // Sale amount
  16. $table->timestamps();
  17. });
  18. }
  19. /**
  20. * Reverse the migrations.
  21. */
  22. public function down(): void
  23. {
  24. Schema::dropIfExists('sales');
  25. }
  26. };