You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2023_09_19_050544_create_contacts_table.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  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('contacts', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  15. $table->string('type')->nullable();
  16. $table->string('first_name');
  17. $table->string('last_name')->nullable();
  18. $table->string('email')->nullable();
  19. $table->json('phones')->nullable();
  20. $table->boolean('is_primary')->default(false);
  21. $table->morphs('contactable');
  22. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  23. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  24. $table->timestamps();
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. */
  30. public function down(): void
  31. {
  32. Schema::dropIfExists('contacts');
  33. }
  34. };