initial commit
This commit is contained in:
95
app/Models/Patient.php
Normal file
95
app/Models/Patient.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user