initial commit

This commit is contained in:
Inshal
2024-10-25 01:02:11 +05:00
commit 6e65bc3a62
1710 changed files with 273609 additions and 0 deletions

89
app/Models/Admin.php Normal file
View File

@@ -0,0 +1,89 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Models\Permission;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Tymon\JWTAuth\Contracts\JWTSubject;
class Admin extends Authenticatable implements JWTSubject
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
'last_name',
'phone_no',
'image_path',
'role_id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
public function role()
{
return $this->belongsTo(Permission::class,'role_id');
}
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Appointment extends Model
{
protected $table = "appointments";
protected $fillable = [
'telemed_pros_id',
'patient_id',
'appointment_time',
'in_call',
'meeting_id',
'agent_call_token',
'patient_call_token',
'video_token',
'appointment_date',
'patient_email',
'patient_name',
'timezone',
'analytics',
'start_time',
'end_time',
'duration',
'status'
];
public function telemedPro()
{
return $this->belongsTo(Telemedpro::class, 'telemed_pros_id', 'id');
}
public function patient()
{
return $this->belongsTo(Patient::class, 'patient_id', 'id');
}
public function getMeetingCountAttribute()
{
return $this->appointments()->count();
}
public function cart()
{
return $this->hasOne(Cart::class);
}
}

52
app/Models/Cart.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Cart extends Model
{
// use HasFactory;
protected $fillable = [
'first_name',
'last_name',
'email',
'phone',
'date_of_birth',
'patient_id',
'shipping_address1',
'shipping_address2',
'shipping_city',
'shipping_state',
'shipping_zipcode',
'shipping_country',
'billing_address1',
'billing_address2',
'billing_city',
'billing_state',
'billing_zipcode',
'billing_country',
'shipping_amount',
'total_amount',
"status",
"lab_kit_id",
"appointment_id",
"note",
'start_subscription',
'end_subscription',
'prescription_status',
'short_description'
];
public function patient()
{
return $this->belongsTo(Patient::class);
}
public function labKit()
{
return $this->belongsTo(LabKit::class);
}
public function labkitOrderItems()
{
return $this->hasMany(LabkitOrderItem::class);
}
}

46
app/Models/Doctor.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class Doctor extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
'designation'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class DoctorAppointment extends Model
{
protected $table = "doctor_appointments";
protected $fillable = [
'patient_id',
'doctor_id',
'doctor_id',
'appointment_id',
'appointment_time',
'telemed_pros_id',
'doctor_call_token',
'appointment_date'
];
}

38
app/Models/Item.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Item extends Model
{
use HasFactory;
protected $fillable = [
'plans_id',
'status',
'cart_id',
'labkit_delivery_status',
'quantity',
'note',
'short_description'
];
public function cart()
{
return $this->belongsTo(Cart::class);
}
public function plansV1()
{
return $this->belongsTo(PlanV1::class, 'plans_id');
}
public function itemHistories()
{
return $this->hasMany(ItemHistory::class, 'item_id');
}
public function labkitOrderItems()
{
return $this->hasMany(LabkitOrderItem::class);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ItemHistory extends Model
{
use HasFactory;
protected $table = "items_history";
protected $fillable = [
'short_description',
'note',
'cart_id',
'item_id',
'status'
];
public function item()
{
return $this->belongsTo(Item::class);
}
}

25
app/Models/Lab.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Lab extends Model
{
protected $table = "labs";
protected $fillable = [
'name',
'address',
'city',
'state',
'zip_code',
'lang',
'lat',
'distance',
'contact_no',
'booking_time',
'appointment_id',
'slot_date',
'slot_time'
];
}

14
app/Models/LabKit.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class LabKit extends Model
{
protected $table = "lab_kit";
protected $fillable = [
'name',
'amount',
];
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LabkitOrderItem extends Model
{
use HasFactory;
// The table associated with the model.
protected $table = 'labkit_order_items';
// The attributes that are mass assignable.
protected $fillable = [
'cart_id',
'item_id',
'result',
'status',
'lab_kit_id'
];
// Define the relationship with the Cart model
public function cart()
{
return $this->belongsTo(Cart::class);
}
// Define the relationship with the Item model
public function item()
{
return $this->belongsTo(Item::class);
}
public function labkitOrderItems()
{
return $this->hasMany(LabkitOrderItem::class);
}
public function labKit()
{
return $this->belongsTo(LabKit::class);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LicenseNumberModel extends Model
{
protected $table = "license_numbers";
protected $fillable = ['provider_id', 'license_number', 'status', 'state'];
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class MedicalHistoryAnswer extends Model
{
protected $table = 'medical_history_answer';
protected $fillable = [
'question_key',
'patient_id',
'type',
'answer'
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class MedicationCategory extends Model
{
use HasFactory;
protected $table = 'medication_categories';
protected $fillable = [
'category_name'
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Notification extends Model
{
use HasFactory, SoftDeletes;
// The attributes that are mass assignable.
protected $fillable = [
'status',
'cart_id',
'patient_id',
'message',
'description',
];
// Define the relationship with the Cart model
public function cart()
{
return $this->belongsTo(Cart::class);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class PasswordResetTokens extends Authenticatable
{
const UPDATED_AT = null;
use HasApiTokens, HasFactory, Notifiable;
protected $fillable = [
'email',
'token'
];
}

95
app/Models/Patient.php Normal file
View File

@@ -0,0 +1,95 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class Patient extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'email',
'password',
'address',
'city',
'state',
'zip_code',
'lat',
'long',
'dob',
'recording_switch',
'country',
"first_name",
"last_name",
"phone_no",
"shipping_address",
"shipping_city",
"shipping_state",
"shipping_country",
"shipping_zipcode",
"timezone",
"gender",
"marital_status",
"height",
"weight",
'profile_picture'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
protected $dates = ['deleted_at'];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
protected $table = "patients";
public function routeNotificationForMail($notification)
{
echo "asked email ";
// Replace 'email_address' with the actual column name in your table
return $this->email;
}
public function getProfileCompletionPercentageAttribute()
{
$activitiesCount = PatientRegActivity::where('patient_id', $this->id)->count();
switch ($activitiesCount) {
case 0:
return 0;
case 1:
return 25;
case 2:
return 50;
case 3:
return 75;
default:
return 100;
}
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class PatientAnswer extends Model
{
protected $table = 'patient_answers';
protected $fillable = [
'patient_id',
'question_id',
'appointment_id',
'answer'
];
}

14
app/Models/PatientLab.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PatientLab extends Model
{
protected $table = "patient_labs";
protected $fillable = [
'patient_id',
'lab_id',
];
}

114
app/Models/PatientNote.php Normal file
View File

@@ -0,0 +1,114 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Auth;
class PatientNote extends Model
{
protected $table = 'patient_notes';
protected $fillable = [
'note',
'note_type',
'patient_id',
'patient_notes',
'appointment_id',
'telemed_pros_id',
'created_by_id',
'created_by_type'
];
protected $appends = ['created_by'];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (Auth::guard('admin')->check()) {
$model->created_by_id = Auth::guard('admin')->id();
$model->created_by_type = 'App\Models\Admin';
} elseif (Auth::check()) {
$model->created_by_id = Auth::id();
$model->created_by_type = 'App\Models\Telemedpro';
}
});
}
public function getCreatedByAttribute()
{
if (!$this->created_by_type || !$this->created_by_id) {
return null;
}
$model = $this->created_by_type::find($this->created_by_id);
if (!$model) {
return null;
}
$type = $this->created_by_type === 'App\Models\Admin' ? 'Admin' : 'Agent';
return $model->name . ' (' . $type . ')';
}
/* public function getCreatedByAttribute()
{
// Check if we're using a custom select
if (!array_key_exists('created_by_id', $this->attributes) || !array_key_exists('created_by_type', $this->attributes)) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
if (!$this->created_by_type || !$this->created_by_id) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
$model = $this->created_by_type::find($this->created_by_id);
if (!$model) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
$type = match ($this->created_by_type) {
'App\Models\Admin' => 'Admin',
'App\Models\Telemedpro' => 'TelemedPro',
//default => 'User',
};
return $model->name . ' (' . $type . ')';
} */
protected $hidden = ['created_by_id', 'created_by_type'];
public function createdBy(): MorphTo
{
return $this->morphTo();
}
public function getCreatedByNameAttribute()
{
return $this->createdBy ? $this->createdBy->name : null;
}
public function appointment()
{
return $this->belongsTo(Appointment::class, 'appointment_id', 'id');
}
public function telemedPro()
{
return $this->belongsTo(TelemedPro::class, 'telemed_pros_id', 'id')->withDefault();
}
public function admin()
{
return $this->belongsTo(Admin::class, 'admin_id', 'id')->withDefault();
}
public function patient()
{
return $this->belongsTo(Patient::class, 'patient_id', 'id');
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PatientPlan extends Model
{
use HasFactory;
protected $table = 'patient_plan';
protected $fillable = [
'patient_id',
'plan_id'
];
public function patient()
{
return $this->belongsTo(Patient::class, 'patient_id', 'id');
}
public function plan()
{
return $this->belongsTo(Plan::class, 'plan_id');
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Auth;
class PatientPrescription extends Model
{
protected $table = 'patient_prescription';
protected $fillable = [
'patient_id',
'prescription_id',
'direction_one',
'direction_two',
'dont_substitute',
'comments',
'appointment_id',
"brand",
"from",
"quantity",
"direction_quantity",
"refill_quantity",
"dosage",
"status",
'created_by_id',
'created_by_type'
];
protected $appends = ['created_by'];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (Auth::guard('admin')->check()) {
$model->created_by_id = Auth::guard('admin')->id();
$model->created_by_type = 'App\Models\Admin';
} elseif (Auth::check()) {
$model->created_by_id = Auth::id();
$model->created_by_type = 'App\Models\Telemedpro';
}
});
}
public function createdBy(): MorphTo
{
return $this->morphTo();
}
public function getCreatedByAttribute()
{
if (!$this->created_by_type || !$this->created_by_id) {
return null;
}
$model = $this->created_by_type::find($this->created_by_id);
if (!$model) {
return null;
}
$type = $this->created_by_type === 'App\Models\Admin' ? 'Admin' : 'Agent';
return $model->name . ' (' . $type . ')';
}
/* public function getCreatedByAttribute()
{
// Check if we're using a custom select
if (!array_key_exists('created_by_id', $this->attributes) || !array_key_exists('created_by_type', $this->attributes)) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
if (!$this->created_by_type || !$this->created_by_id) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
$model = $this->created_by_type::find($this->created_by_id);
if (!$model) {
return $this->provide_name ? $this->provide_name . ' (Provider)' : null;
}
$type = match ($this->created_by_type) {
'App\Models\Admin' => 'Admin',
'App\Models\Telemedpro' => 'TelemedPro',
//default => 'User',
};
return $model->name . ' (' . $type . ')';
} */
protected $hidden = ['created_by_id', 'created_by_type'];
public function patient()
{
return $this->belongsTo(Patient::class, 'patient_id');
}
public function prescription()
{
return $this->belongsTo(Prescription::class, 'prescription_id');
}
public function appointment()
{
return $this->belongsTo(Appointment::class, 'appointment_id', 'id');
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class PatientRegActivity extends Model
{
use Notifiable;
protected $table = "patient_reg_activity";
protected $fillable = [
'id',
'activity',
'patient_id',
'email_sent'
];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PatientTask extends Model
{
protected $table = "patient_tasks";
protected $fillable = [
'patient_id',
'description',
'is_solved'
];
}

19
app/Models/Payment.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
use HasFactory;
protected $fillable = [
'card_number',
'cvv',
'expiration_year',
'expiration_month',
'order_id',
];
}

36
app/Models/Permission.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
// protected $table = "permissions";
protected $fillable = [
'role_name',
'role_guard',
'permissions'
];
protected $casts = [
'permissions' => 'array',
];
public function havePermission($name)
{
$permissions = $this->permissions;
if(!$permissions)
return false;
if(in_array($name,$permissions))
{
return true;
}
else
{
foreach($permissions as $permission){
if(strpos($permission,$name)===0)
return true;
}
}
return false;
}
}

17
app/Models/Plan.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Plan extends Model
{
protected $table = "plans";
protected $fillable = [
'plan_name',
'plan_amount',
'patient_id',
'appointment_id',
];
}

37
app/Models/PlanV1.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class PlanV1 extends Model
{
use HasFactory;
protected $table = 'plans_v1';
protected $fillable = [
'title',
'currency',
'price',
'list_one_title',
'list_two_title',
'list_sub_title',
'image_url',
'slug',
'domain',
'medication_category_id',
'product_file_path',
'is_prescription_required',
'shipping_cost'
];
public static function generateUniqueSlug($title)
{
$slug = Str::slug($title);
$count = self::where('slug', 'like', "$slug%")->count();
return $count ? "{$slug}-{$count}" : $slug;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
class Prescription extends Model
{
protected $table = 'prescriptions';
protected $fillable = [
'name',
'brand',
'from',
'dosage',
'quantity',
'direction_quantity',
'refill_quantity'
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductCategory extends Model
{
use HasFactory;
protected $table = 'product_category';
protected $fillable = [
'product_id',
'category_id'
];
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfileAnswer extends Model
{
use HasFactory;
protected $fillable = [
'answer', 'patient_id', 'question_category_id', 'sub_question_id'
];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfileCategory extends Model
{
use HasFactory;
protected $fillable = ['name', 'status', 'icon', 'category_link'];
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfileCategoryQuestion extends Model
{
use HasFactory;
protected $table = "profile_category_question";
protected $fillable = ['category_id', 'question_id'];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfileQuestion extends Model
{
use HasFactory;
protected $fillable = ['question', 'question_type', 'question_options'];
public function getQuestionOptionsAttribute($value)
{
return unserialize($value);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfileSubQuestion extends Model
{
use HasFactory;
protected $fillable = ['category_id', 'question_id', 'question', 'parent_sub_question_id', 'sub_question_type', 'sub_question_options'];
public function getSubQuestionOptionsAttribute($value)
{
return unserialize($value);
}
public function subQuestions()
{
return $this->hasMany(ProfileSubQuestion::class, 'parent_sub_question_id', 'id');
}
public function parentQuestion()
{
return $this->belongsTo(ProfileSubQuestion::class, 'parent_sub_question_id');
}
}

28
app/Models/Question.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
class Question extends Model
{
use SoftDeletes;
protected $table = 'questions';
protected $fillable = [
'question',
'type',
'options'
];
protected $dates = ['deleted_at'];
public function getAnswer(): BelongsTo
{
return $this->belongsTo(PatientAnswer::class, 'appointment_id');
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class QuestionBuilder extends Model
{
use HasFactory;
protected $table = "question_builder";
protected $fillable = ['key', 'value', 'customer_id', 'profile_category_id'];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class QuestionGroup extends Model
{
protected $fillable = [
'title',
'status'
];
public function questions()
{
return $this->hasMany(Question::class);
}
}

31
app/Models/Queue.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Queue extends Model
{
use SoftDeletes;
protected $table = 'queue';
protected $fillable = [
'patient_id',
'telemed_pros_id',
'queue_number'
];
public function patient()
{
return $this->belongsTo(Patient::class);
}
public function telemedPro()
{
return $this->belongsTo(TelemedPro::class);
}
}

27
app/Models/Setting.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
protected $table = 'settings';
protected $fillable = [
'plan_main_title',
'plan_description',
'plan_description_pargraph',
'logo',
'footer_text',
'favicon',
'header_title',
'domain_name',
'calendly_access_token',
'calendly_refresh_token',
'event_type'
];
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Subscription extends Model
{
use HasFactory;
protected $table = "subscription";
protected $fillable = [
'subscription_start_date',
'subscription_renewal_date',
'subscription_status',
'cart_id',
'item_id',
'patient_id',
// 'status'
];
public function cart()
{
return $this->belongsTo(Cart::class);
}
public function item()
{
return $this->belongsTo(Item::class);
}
public function patient()
{
return $this->belongsTo(Patient::class);
}
}

68
app/Models/Telemedpro.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class Telemedpro extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $table = "telemed_pros";
protected $fillable = [
'name',
'first_name',
'last_name',
'email',
'password',
'is_busy',
'recording_switch',
"ai_switch",
"status",
"practice_state",
"phone_number",
"gender",
"specialty",
"home_address",
"medical_license_number",
"years_of_experience",
"email_verification",
"city",
"state",
"zip_code",
"availability_to",
"availability_from"
];
protected $hidden = [
'password',
'remember_token',
];
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
/* 'state' => 'array', */
];
public function appointments()
{
return $this->hasMany(Appointment::class, 'telemed_pros_id');
}
public function getMeetingCountAttribute()
{
return $this->appointments()
->whereHas('cart', function ($query) {
$query->whereNotNull('appointment_id');
})
->count();
}
}

45
app/Models/User.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}