mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
24 lines
534 B
PHP
24 lines
534 B
PHP
<?php
|
|
|
|
/**
|
|
* Check if current user subscribed plan is highest
|
|
*
|
|
* @param $id
|
|
* @param $subscribed_capacity
|
|
* @return int
|
|
*/
|
|
function is_highest_plan($plan)
|
|
{
|
|
$plans = app('rinvex.subscriptions.plan')->all();
|
|
|
|
$unsubscribed = $plans->filter(function ($item) use ($plan) {
|
|
return $item->id !== $plan->id;
|
|
});
|
|
|
|
$capacities = $unsubscribed->map(function ($item) {
|
|
return $item->features->first()->value;
|
|
});
|
|
|
|
return max(Arr::flatten($capacities)) < $plan->features->first()->value ? 1 : 0;
|
|
}
|