Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -317,7 +317,6 @@ class Helper
|
||||
{
|
||||
// Buat instance PHPMailer
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
// Server settings
|
||||
$mail->isSMTP();
|
||||
@@ -341,8 +340,46 @@ class Helper
|
||||
// Kirim email
|
||||
$mail->send();
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
//var_dump($mail->ErrorInfo);die();
|
||||
dd($e);
|
||||
return ($mail->ErrorInfo);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendEmailattachData($data = array())
|
||||
{
|
||||
// Buat instance PHPMailer
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
// Server settings
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = env('EMAIL');
|
||||
$mail->Password = env('PW_EMAIL');
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||
$mail->Port = 465;
|
||||
$mail->SMTPSecure = "ssl";
|
||||
|
||||
// Penerima email
|
||||
$mail->setFrom(env('EMAIL'), env('NAME_EMAIL'));
|
||||
$mail->addAddress($data['email'], $data['name']);
|
||||
|
||||
// Konten email
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = $data['subject'];
|
||||
$mail->Body = $data['body'];
|
||||
$mail->addAttachment($data['attach'], 'e-card.pdf');
|
||||
|
||||
// Kirim email
|
||||
$mail->send();
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
dd($mail->ErrorInfo);
|
||||
return ($mail->ErrorInfo);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,19 +255,46 @@ class Member extends Model
|
||||
);
|
||||
}
|
||||
|
||||
protected function birthDate(): Attribute
|
||||
// protected function birthDate(): Attribute
|
||||
// {
|
||||
// // $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
// $date = $this->birth_date ?? ($this->person->birth_date ?? null);
|
||||
// return Attribute::make(
|
||||
// get: fn () => !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null
|
||||
// );
|
||||
// }
|
||||
|
||||
protected function birthDateeCard(): Attribute
|
||||
{
|
||||
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
$date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
$date = $this->birth_date ?? ($this->birth_date ?? this->person->birth_date);
|
||||
return Attribute::make(
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
|
||||
);
|
||||
}
|
||||
|
||||
protected function startDate(): Attribute
|
||||
{
|
||||
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
$date = $this->members_effective_date;
|
||||
return Attribute::make(
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
|
||||
);
|
||||
}
|
||||
|
||||
protected function endDate(): Attribute
|
||||
{
|
||||
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
$date = $this->members_expire_date;
|
||||
return Attribute::make(
|
||||
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
|
||||
);
|
||||
}
|
||||
|
||||
protected function gender(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => $this->person->gender ?? null
|
||||
get: fn () => ucfirst($this->person->gender) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
99
app/Models/RequestDailyMonitoring.php
Normal file
99
app/Models/RequestDailyMonitoring.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class RequestDailyMonitoring extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "request_log_daily_monitorings";
|
||||
|
||||
protected $fillable = [
|
||||
'request_log_id',
|
||||
'subject',
|
||||
'body_temperature',
|
||||
'respiration_rate',
|
||||
'sistole',
|
||||
'diastole',
|
||||
'analysis',
|
||||
'lab_date',
|
||||
'provider',
|
||||
'examination',
|
||||
];
|
||||
|
||||
protected $appends = ['medical_plan', 'non_medikamentosa_plan', 'document', 'discharge_date'];
|
||||
|
||||
public function getBodyTemperatureAttribute()
|
||||
{
|
||||
return round($this->attributes['body_temperature'], 0);
|
||||
}
|
||||
|
||||
public function getSistoleAttribute()
|
||||
{
|
||||
return round($this->attributes['sistole'], 0);
|
||||
}
|
||||
|
||||
public function getDiastoleAttribute()
|
||||
{
|
||||
return round($this->attributes['diastole'], 0);
|
||||
}
|
||||
|
||||
public function getRespirationRateAttribute()
|
||||
{
|
||||
return round($this->attributes['respiration_rate'], 0);
|
||||
}
|
||||
|
||||
public function getMedicalPlanAttribute()
|
||||
{
|
||||
$arr_medical_plan = [];
|
||||
$medical_plan = DB::table('request_log_medical_plan')->where(['request_log_daily_monitoring_id' => $this->attributes['id'], 'type' => 1])->get();
|
||||
|
||||
foreach ($medical_plan as $row) {
|
||||
$arr_medical_plan[] = [
|
||||
'medical_plan_str' => $row->plan
|
||||
];
|
||||
}
|
||||
|
||||
return $arr_medical_plan;
|
||||
}
|
||||
|
||||
public function getNonMedikamentosaPlanAttribute()
|
||||
{
|
||||
$arr_non_medikamentosa_plan = [];
|
||||
$non_medikamentosa_plan = DB::table('request_log_medical_plan')->where(['request_log_daily_monitoring_id' => $this->attributes['id'], 'type' => 2])->get();
|
||||
|
||||
foreach ($non_medikamentosa_plan as $row) {
|
||||
$arr_non_medikamentosa_plan[] = [
|
||||
'non_medikamentosa_plan_str' => $row->plan
|
||||
];
|
||||
}
|
||||
|
||||
return $arr_non_medikamentosa_plan;
|
||||
}
|
||||
|
||||
public function getDocumentAttribute()
|
||||
{
|
||||
$arr_document = [];
|
||||
$document = DB::table('files')->where(['fileable_type' => 'App\Models\LaboratoriumResult', 'fileable_id' => $this->attributes['id']])->get();
|
||||
|
||||
foreach ($document as $row) {
|
||||
$arr_document[] = [
|
||||
'file_name' => $row->original_name,
|
||||
'path' => env('APP_URL') . '/storage/lab_result/' . $row->original_name,
|
||||
'type' => $row->type,
|
||||
];
|
||||
}
|
||||
|
||||
return $arr_document;
|
||||
}
|
||||
|
||||
public function getDischargeDateAttribute()
|
||||
{
|
||||
return $discharge_date = DB::table('request_logs')->where('id', $this->attributes['request_log_id'])->select('discharge_date')->first();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user