initial commit

This commit is contained in:
Debian
2026-06-03 04:18:36 +07:00
commit a5569ce2a0
220 changed files with 30797 additions and 0 deletions
@@ -0,0 +1,43 @@
<?php
namespace Database\Factories;
use App\Models\Consultation;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Consultation>
*/
class ConsultationFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Consultation::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
// Get a random patient from the users table
$patient = User::where('user_role', 'user')->inRandomOrder()->first();
// Get a random doctor from the users table
$doctor = User::where('user_role', 'doctor')->inRandomOrder()->first();
return [
'patient_id' => $patient->id,
'doctor_id' => $doctor->id,
'consultation_date' => $this->faker->dateTimeBetween('-1 year', '+1 year')->format('Y-m-d'),
'consultation_time' => $this->faker->time('H:i:s'),
'location' => $this->faker->city,
'consultation_status' => $this->faker->randomElement(['pending', 'declined', 'approved', 'finished']),
];
}
}
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use App\Models\User;
use Faker\Factory as FakerFactory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$faker = FakerFactory::create('en_US');
return [
'user_role' => $faker->randomElement(['admin', 'user', 'doctor']),
'username' => $faker->userName,
'password' => Hash::make('password'),
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'telepon' => $faker->phoneNumber,
'alamat' => $faker->address,
'gender' => $faker->randomElement(['male', 'female']),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}