purityselect/app/Console/Commands/InsertDataForPatient.php
2024-10-25 01:05:27 +05:00

88 lines
2.9 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Appointment;
use App\Models\Cart;
use App\Models\LabKit;
use App\Models\Telemedpro;
use App\Models\Patient;
use App\Models\PatientNote;
use App\Models\PatientPlan;
use App\Models\PatientPrescription;
use App\Models\PatientRegActivity;
use App\Models\PlanV1;
use App\Models\Prescription;
use App\Models\ProfileCategory;
use App\Models\QuestionBuilder;
use Illuminate\Support\Str;
use Carbon\Carbon;
use DateTime;
use Faker\Factory as Faker;
class InsertDataForPatient extends Command
{
protected $signature = 'insert:data-patient';
protected $description = 'Insert plans data into the database based on the provided type';
public function __construct()
{
parent::__construct();
}
public function handle()
{
/* for ($i = 0; $i < 10; $i++) {
Telemedpro::create([
'name' => 'Telemedpro ' . ($i + 1),
'email' => 'telemedpro' . ($i + 1) . '@example.com',
'phone' => '123-456-789' . $i,
]);
} */
$faker = Faker::create();
for ($i = 10000; $i < 20000; $i++) {
$patient = Patient::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => $faker->unique()->safeEmail,
'phone' => $faker->phoneNumber,
'password' => bcrypt("12345"),
'address' => $faker->address,
'city' => $faker->city,
'state' => $faker->state,
'zip_code' => $faker->postcode,
'lat' => $faker->latitude,
'long' => $faker->longitude,
'dob' => $faker->date($format = 'Y-m-d', $max = 'now'),
'recording_switch' => $faker->boolean,
'country' => $faker->country,
'phone_no' => $faker->phoneNumber,
'shipping_address' => $faker->address,
'shipping_city' => $faker->city,
'shipping_state' => $faker->state,
'shipping_country' => $faker->country,
'shipping_zipcode' => $faker->postcode,
'timezone' => 'UTC',
'gender' => $faker->randomElement(['male', 'female']),
'marital_status' => $faker->randomElement(['single', 'married']),
'height' => $faker->numberBetween(150, 200), // Height in cm
'weight' => $faker->numberBetween(50, 100) // Weight in kg
]);
PatientRegActivity::create([
'patient_id' => $patient->id,
'activity' => 'patient_registered'
]);
$plans = PlanV1::all();
PatientPlan::create([
'patient_id' => $patient->id,
'plan_id' => $plans->random()->id,
]);
}
}
}