Added more database fields for contacts. Worked on popovers in customers view. #3

This commit is contained in:
2025-11-04 15:17:23 +01:00
parent 82e04acc2c
commit 15b49f4d23
5 changed files with 139 additions and 20 deletions
+28 -4
View File
@@ -21,16 +21,40 @@ public function definition()
}
$gender = rand(0, 9) >= 5 ? 'female' : 'male';
return [
$userName = $this->faker->userName();
$hasLinkedIn = rand(0, 9) >= 7;
$hasMatrix = rand(0, 9) >= 7;
$hasGithub = rand(0, 9) >= 7;
$contact = [
'is_primary' => $this->faker->boolean(30),
'salutation' => $this->faker->title($gender),
'first_name' => $this->faker->firstName($gender),
'last_name' => $this->faker->lastName($gender),
'job_title' => $this->faker->jobTitle(),
'email' => $this->faker->unique()->safeEmail(),
'phone' => $this->faker->phoneNumber(),
'position' => $this->faker->jobTitle(),
'is_primary' => $this->faker->boolean(30),
'mobile_phone' => $this->faker->phoneNumber(),
'avatar' => $avatar,
'online_accounts' => []
];
if ($hasLinkedIn) $contact[] = [
'platform' => 'linkedin',
'user_name' => $userName,
'url' => 'https://www.linkedin.com/in/' . $userName
];
if ($hasMatrix) $contact[] = [
'platform' => 'matrix',
'user_name' => $userName,
'url' => '@' . $userName . ':matrix.org'
];
if ($hasGithub) $contact[] = [
'platform' => 'github',
'user_name' => $userName,
'url' => 'https://www.github.com/' . $userName
];
return $contact;
}
}
@@ -11,14 +11,18 @@ public function up()
Schema::create('contacts', function (Blueprint $table) {
$table->id();
$table->foreignId('customer_id')->constrained()->onDelete('cascade');
$table->boolean('is_primary')->default(false);
$table->string('salutation', 20);
$table->string('academic_title', 20)->nullable();
$table->string('first_name', 50);
$table->string('last_name', 50);
$table->string('job_title', 100)->nullable();
$table->string('email', 100)->nullable();
$table->string('phone', 20)->nullable();
$table->string('position', 100)->nullable();
$table->boolean('is_primary')->default(false);
$table->string('mobile_phone', 20)->nullable();
$table->string('avatar')->nullable();
$table->json('online_accounts')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
});
}