Change Permission & WIP Dashboard Client Portal
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Client\Transformers\Dashboard;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TopUpLimitResources extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$myLimitBalance = (int)$this->currentPolicy->limit_balance;
|
||||
$myLimitTotal = (int)$this->currentPolicy->total_premi;
|
||||
|
||||
return [
|
||||
'companyName' => $this->name,
|
||||
'policyNumber' => $this->currentPolicy->code,
|
||||
'totalMembers' => $this->employees_count,
|
||||
'totalCases' => $this->claims_count,
|
||||
'myLimit' => [
|
||||
'balance' => $myLimitBalance,
|
||||
'total' => $myLimitTotal,
|
||||
'percentage' => $myLimitTotal ? round(($myLimitBalance / $myLimitTotal) * 100, 2) : 0,
|
||||
],
|
||||
'maxTopUp' => ($myLimitTotal - $myLimitBalance)
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user