@php $componentKey = strtolower($component->component_key); $cacheKey = "component_definition_{$componentKey}"; $definition = cache()->rememberForever($cacheKey, function () use ($componentKey) { $file = resource_path("structure/page_component/{$componentKey}.php"); return file_exists($file) ? include $file : []; }); $limit = $definition['repeated_content_limit'] ?? null; $currentCount = $component->repeatedContents()->count(); $isLimitOver = $component->limitRepeatedContentsOver(); $remaining = is_numeric($limit) && $limit > 0 ? max(0, (int)$limit - $currentCount) : null; @endphp @if(is_numeric($limit) && $limit > 0)
resources/structure/page_component/' . $componentKey . '.php',
'code' => '\'repeated_content_limit\' => ' . $limit . ''
])
resources/structure/page_component/' . $componentKey . '.php'
])
resources/structure/page_component/' . $componentKey . '.php'
])