Merge branch 'feature/hospital-portal'
This commit is contained in:
@@ -18,6 +18,15 @@ class Benefit extends Model
|
||||
'active'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"deleted_at",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"deleted_by",
|
||||
];
|
||||
|
||||
public function scopeFilter($query, array $filters)
|
||||
{
|
||||
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||
|
||||
52
app/Models/ClaimRequest.php
Normal file
52
app/Models/ClaimRequest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ClaimRequest extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, Blameable;
|
||||
|
||||
protected static $code_prefix = 'CRQ';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
try {
|
||||
$model->code = self::getNextCode();
|
||||
} catch (\Exception $e) {
|
||||
abort(500, $e->getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function getNextCode()
|
||||
{
|
||||
$last_number = self::withTrashed()->max('code');
|
||||
$next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[1] + 1);
|
||||
|
||||
return self::makeCode($next_number);
|
||||
}
|
||||
|
||||
public static function makeCode($next_number)
|
||||
{
|
||||
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public $fillable = [
|
||||
'submission_date',
|
||||
'member_id',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function member()
|
||||
{
|
||||
return $this->belongsTo(Member::class, 'member_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -192,12 +192,13 @@ class Member extends Model
|
||||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return $this->person->name ?? null;
|
||||
return $this->person->name ?? ($this->name ?? null);
|
||||
}
|
||||
|
||||
public function getBirthDateAttribute()
|
||||
{
|
||||
return Carbon::parse($this->person->birth_date ?? null)->format('Y-m-d') ?? null;
|
||||
$date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||
return !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null;
|
||||
}
|
||||
|
||||
public function getGenderAttribute()
|
||||
|
||||
@@ -182,7 +182,63 @@ class Plan extends Model
|
||||
return $this->belongsToMany(Benefit::class, 'corporate_benefits', 'plan_id', 'benefit_id')
|
||||
->withTimestamps()
|
||||
->withPivot([
|
||||
// TODO corporate_benefits pivot
|
||||
'corporate_id',
|
||||
'plan_id',
|
||||
'benefit_id',
|
||||
'corporate_benefit_code',
|
||||
'budget',
|
||||
'budget_conditions',
|
||||
'budget_code',
|
||||
'primary_benefit_code',
|
||||
'benefit_mode',
|
||||
'room_class_coverage',
|
||||
'max_bed_coverage',
|
||||
'tolerance_parameter',
|
||||
'max_room_class',
|
||||
'limit_amount',
|
||||
'area_limit',
|
||||
'shared_benefit',
|
||||
'shared_benefit_type',
|
||||
'msc',
|
||||
'genders',
|
||||
'min_age',
|
||||
'max_age',
|
||||
'max_frequency_period',
|
||||
'daily_frequency',
|
||||
'weekly_frequency',
|
||||
'monthly_frequency',
|
||||
'yearly_frequency',
|
||||
'custom_frequency_days',
|
||||
'custom_duration_value',
|
||||
'allowed_transaction_types',
|
||||
'high_plan_factor',
|
||||
'pre_post_treatment',
|
||||
'pre_treatment_days',
|
||||
'post_treatment_days',
|
||||
'layer_type_1',
|
||||
'layer_value_1',
|
||||
'layer_type_2',
|
||||
'layer_value_2',
|
||||
'cashless_percentage',
|
||||
'reimbursement_percentage',
|
||||
'digital_percentage',
|
||||
'co_share_m_percentage',
|
||||
'co_share_s_percentage',
|
||||
'co_share_c_percentage',
|
||||
'cashless_deductible',
|
||||
'reimbursement_deductible',
|
||||
'digital_deductible',
|
||||
'co_share_m_deductible',
|
||||
'co_share_s_deductible',
|
||||
'co_share_c_deductible',
|
||||
'prorate_type',
|
||||
'prorate_lookup',
|
||||
'max_days_for_disability',
|
||||
'max_period_for_disability',
|
||||
'currency',
|
||||
'show_benefit_item',
|
||||
'show_benefit_value',
|
||||
'active'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -190,4 +246,9 @@ class Plan extends Model
|
||||
{
|
||||
return $this->hasMany(CorporateBenefit::class, 'plan_id', 'id');
|
||||
}
|
||||
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo(Service::class, 'service_code', 'code');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,9 @@ class Service extends Model
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function corporateService()
|
||||
{
|
||||
return $this->hasMany(CorporateService::class, 'service_code', 'code');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
||||
Reference in New Issue
Block a user