Add Plan Limit & Usage
This commit is contained in:
@@ -256,6 +256,7 @@ class MembershipController extends Controller
|
|||||||
{
|
{
|
||||||
$member = Member::where('member_id', $member_id)->firstOrFail();
|
$member = Member::where('member_id', $member_id)->firstOrFail();
|
||||||
$member->load(['currentPlan', 'memberPlans']);
|
$member->load(['currentPlan', 'memberPlans']);
|
||||||
|
$member->totalUsage = ClaimService::getMemberTotalUsage($member);
|
||||||
|
|
||||||
return Helper::responseJson(data: MemberResource::make($member));
|
return Helper::responseJson(data: MemberResource::make($member));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\OLDLMS;
|
namespace App\Http\Resources\OLDLMS;
|
||||||
|
|
||||||
|
use App\Services\ClaimService;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class MemberResource extends JsonResource
|
class MemberResource extends JsonResource
|
||||||
@@ -27,16 +28,18 @@ class MemberResource extends JsonResource
|
|||||||
'plan' => $currentMemberPlan ? [
|
'plan' => $currentMemberPlan ? [
|
||||||
'code' => $currentMemberPlan->plan->code ?? null,
|
'code' => $currentMemberPlan->plan->code ?? null,
|
||||||
'start' => $currentMemberPlan->start,
|
'start' => $currentMemberPlan->start,
|
||||||
'end' => $currentMemberPlan->end
|
'end' => $currentMemberPlan->end,
|
||||||
|
'limit' => $this->currentPlan->limit_rules
|
||||||
] : null,
|
] : null,
|
||||||
'policy_code' => $this->currentPolicy->code,
|
'policy_code' => $this->currentPolicy?->code ?? null,
|
||||||
'corporate' => [
|
'corporate' => [
|
||||||
'code' => $this->currentPolicy->corporate->code,
|
'code' => $this->currentPolicy?->corporate->code ?? null,
|
||||||
'name' => $this->currentPolicy->corporate->name,
|
'name' => $this->currentPolicy?->corporate->name,
|
||||||
'welcome_message' => $this->currentPolicy->corporate->welcome_message,
|
'welcome_message' => $this->currentPolicy?->corporate?->welcome_message,
|
||||||
'help_text' => $this->currentPolicy->corporate->help_text,
|
'help_text' => $this->currentPolicy?->corporate?->help_text,
|
||||||
'avatar_url' => $this->currentpolicy->corporate->avatar_url
|
'avatar_url' => $this->currentpolicy?->corporate?->avatar_url
|
||||||
]
|
],
|
||||||
|
'limit_usage' => $this->totalUsage ?? null
|
||||||
];
|
];
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user