Enforce task limits and update event form
This commit is contained in:
@@ -97,13 +97,26 @@ class EventResource extends JsonResource
|
||||
'watermark_allowed' => (bool) optional($eventPackage->package)->watermark_allowed,
|
||||
] : null,
|
||||
'limits' => $eventPackage && $limitEvaluator
|
||||
? $limitEvaluator->summarizeEventPackage($eventPackage)
|
||||
? $limitEvaluator->summarizeEventPackage($eventPackage, $this->resolveTasksUsed())
|
||||
: null,
|
||||
'addons' => $eventPackage ? $this->formatAddons($eventPackage) : [],
|
||||
'member_permissions' => $memberPermissions,
|
||||
];
|
||||
}
|
||||
|
||||
protected function resolveTasksUsed(): ?int
|
||||
{
|
||||
if (isset($this->tasks_count)) {
|
||||
return (int) $this->tasks_count;
|
||||
}
|
||||
|
||||
if ($this->relationLoaded('tasks')) {
|
||||
return $this->tasks->count();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
* @return array<string, mixed>
|
||||
|
||||
Reference in New Issue
Block a user