<?php
 if (! function_exists('addon_asset')) { function addon_asset(string $name, string $path): string { return asset('addons/' . $name . '/' . ltrim($path, '/')); } } if (! function_exists('addon_url')) { function addon_url(string $name, ?string $action = null, array $params = [], bool $admin = true): string { $base = $admin ? '/admin/addons/' : '/clientarea/addons/'; $url = $base . $name; if ($action !== null && $action !== '') { $url .= '/' . $action; if (! empty($params)) { $url .= '/' . implode('/', $params); } } return url($url); } } if (! function_exists('addon_route')) { function addon_route(string $name, ?string $action = null, array $params = [], bool $admin = true): string { $routeName = $admin ? 'admin.addons.dispatch' : 'store.auth.addons.dispatch'; return route($routeName, array_filter([ 'name' => $name, 'action' => $action, 'params' => empty($params) ? null : implode('/', $params), ])); } } 