rejuvallife/app/Models/Patient.php
2024-10-25 01:02:11 +05:00

96 lines
2.2 KiB
PHP

<?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;
}
}
}