[Clien Portal] Alarm Center - Service Monitoring

This commit is contained in:
Muhammad Fajar
2024-01-14 11:35:44 +07:00
parent d659e8fd4e
commit 62d5dce772
9 changed files with 698 additions and 456 deletions

View File

@@ -394,22 +394,22 @@ class Member extends Model
// );
// }
protected function corporateLogo(): Attribute
{
$avatar = null;
// protected function corporateLogo(): Attribute
// {
// $avatar = null;
if ($this->relationLoaded('currentPolicy')) {
$corporateId = $this->currentPolicy->corporate->id;
$avatar = File::where(['type' => 'avatar', 'fileable_id' => $corporateId])
->orderBy('id', 'desc')
->first();
}
// if ($this->relationLoaded('currentPolicy')) {
// $corporateId = $this->currentPolicy->corporate->id;
// $avatar = File::where(['type' => 'avatar', 'fileable_id' => $corporateId])
// ->orderBy('id', 'desc')
// ->first();
// }
$path = $avatar ? $_ENV['LMS_APP_STORAGE'] . $avatar->path : '';
// $path = $avatar ? $_ENV['LMS_APP_STORAGE'] . $avatar->path : '';
return Attribute::make(
get: fn () => $path
);
}
// return Attribute::make(
// get: fn () => $path
// );
// }
/* -------------------------------------------------------------------------- */
}

View File

@@ -241,11 +241,6 @@ class RequestLog extends Model
return $this->belongsTo(Service::class, 'service_code', 'code');
}
public function requestLogBenefit()
{
return $this->hasOne(RequestLogBenefit::class, 'request_log_id');
}
public function requestLogBenefits()
{
return $this->hasMany(RequestLogBenefit::class, 'request_log_id');

View File

@@ -31,6 +31,6 @@ class RequestLogBenefit extends Model
public function requestLog()
{
return $this->belongsTo(RequestLog::class, 'aa');
return $this->belongsTo(RequestLog::class);
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -18,4 +19,13 @@ class RequestLogDailyMonitoring extends Model
{
return $this->hasMany(RequestLogMedicalPlan::class);
}
/* -------------------------------------------------------------------------- */
protected function code(): Attribute
{
return Attribute::make(
get: fn ($value, $attributes) => 'RE-' . str_pad($attributes['id'], 3, '0', STR_PAD_LEFT),
);
}
}

View File

@@ -9,6 +9,8 @@ class RequestLogMedicalPlan extends Model
{
use HasFactory;
protected $table = 'request_log_medical_plan';
public function requestLogDailyMonitoring()
{
return $this->belongsTo(RequestLogDailyMonitoring::class);