create table component & connect api for dashboard
This commit is contained in:
30
Modules/Client/Transformers/Dashboard/MemberResources.php
Normal file
30
Modules/Client/Transformers/Dashboard/MemberResources.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Client\Transformers\Dashboard;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MemberResources extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'memberId' => $this->member_id,
|
||||
'fullName' => $this->full_name,
|
||||
'division' => $this->division_name ?? '',
|
||||
'limit' => [
|
||||
'current' => $this->claims_sum_total_claim,
|
||||
'total' => $this->currentPlan->limit_rules ?? 0,
|
||||
'percentage' => (!empty($this->currentPlan->limit_rules ?? 0)) ? (($this->claims_sum_total_claim / $this->currentPlan->limit_rules) * 100) : 0
|
||||
],
|
||||
'status' => $this->active,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user