Skip to content

Assets & URLs Helper Functions

These helpers resolve asset paths and generate URLs. They are defined in app/Support/theme_helpers.php.


theme_asset(string $path = ''): string

Resolves a URL for a theme static asset (CSS, JS, images). If S3 is configured, it will return the S3 CDN URL. Otherwise it falls back to the public URL of the theme's asset directory.

{{-- Load a CSS file from your theme's assets folder --}}
<link rel="stylesheet" href="{{ theme_asset('css/style.css') }}">

{{-- Load a JS file --}}
<script src="{{ theme_asset('js/app.js') }}"></script>

{{-- Use an image --}}
<img src="{{ theme_asset('images/logo.png') }}" alt="Logo">

{{-- Get the base URL of theme assets (no path argument) --}}
@php $themeBase = theme_asset(); @endphp

S3 Support

If the site has S3 storage enabled, theme_asset() automatically generates an S3 URL. The path format on S3 is files/s{site_id}/templates/{theme_name}/{your_path}.


cdn_asset(string $path = ''): string

Resolves a URL from the configured CDN base URL. Used for shared assets like Bootstrap or jQuery that are not theme-specific.

<link rel="stylesheet" href="{{ cdn_asset('css/bootstrap.min.css') }}">
<script src="{{ cdn_asset('js/jquery.min.js') }}"></script>

same_origin_asset(string $path = ''): string

Returns a URL that is guaranteed to be on the same origin as the current server (useful for CORS-sensitive resources like web workers or fonts).

<script src="{{ same_origin_asset('js/service-worker.js') }}"></script>

customUrl(string $path, mixed $custom = false): string

The most-used URL helper. Maps named application routes to their real URL paths. Use this instead of hardcoding URLs.

<a href="{{ customUrl('home') }}">Home</a>
<a href="{{ customUrl('login') }}">Login</a>
<a href="{{ customUrl('cart_list') }}">View Cart</a>

Available Path Aliases

Alias Resolves to Notes
'home' / Homepage
'login' /user/login Login page
'register' /user/register Registration page
'logout' /user/logout Logout action
'myaccount' /user/myaccount My Account dashboard
'mycredit' /user/mycredit Customer credits page
'wishlist' /user/wishlist Wishlist page
'reviewmyorders' /user/reviewmyorders Order history page
'payment' /payment Payment page
'cart_list' /cart/list Shopping cart
'checkout_address' /checkout/address Checkout: address step
'checkout_invoice' /checkout/invoice Checkout: invoice step
'order_list' /order/list Order list page
'order_tracking' /order/tracking Order tracking page
'order_merchandisereturn' /order/merchandisereturn Merchandise return page
'address_book' /address/book Address book
'productlist' /category/productlist All products list
'new' /category/new New arrivals category
'featureproduct' /category/featureproduct Featured products category
'specialoffers' /category/specialoffers Special offers category
'sms_index' /sms SMS page

For any other string, customUrl() will: 1. Try to split it on _ (e.g. 'product_123'/product/123) 2. Fall back to /your_path


theme_url(string $path = ''): string

Generates an absolute URL using the application's base URL.

<a href="{{ theme_url('about-us') }}">About Us</a>
{{-- Output: https://www.mystore.com/about-us --}}

{{-- Special case for video page --}}
<a href="{{ theme_url('home/video') }}">Video Gallery</a>
{{-- Output: https://www.mystore.com/index/video --}}

serverUrl(): string

Returns the bare base URL of the server, with no trailing path.

<meta property="og:url" content="{{ serverUrl() . '/my-product' }}">
{{-- Output: https://www.mystore.com/my-product --}}

createUrl(string $path): string

Simple wrapper around Laravel's url() helper. Ensures the path is correctly prefixed.

<a href="{{ createUrl('/contact') }}">Contact</a>

trackingUrl(?string $serviceCode, ?string $trackingNumber = null): string

Generates a carrier tracking URL for a given shipment.

Supported carriers:

Carrier Code Carrier Name
'FedEx', 'FedExCanada' FedEx
'UPS', 'ups' UPS
'USPS', 'usps' USPS
'CanadaPost', 'Canada Post' Canada Post
'DHLCanada', 'DHLUK', 'DHLAustralia', 'DHLGlobalMail' DHL
'AustraliaPost' Australia Post
'RoyalMail' Royal Mail
'IMEX' IMEX
'APC' APC
'Asendia' Asendia
'LoneStar' LoneStar
'Purolator' PurolatorCA
{{-- Display a tracking link in an order confirmation --}}
@if($order->trackingCode)
    <a href="{{ trackingUrl($order->shippingMethod, $order->trackingCode) }}" target="_blank">
        Track Your Package ({{ $order->shippingMethod }})
    </a>
@endif

hybridAuth(string $url, string $service): string

Appends a ?service= query parameter to a URL for OAuth login (Google, Facebook, Amazon).

@if(!empty($page->settings->google_status) && (int)$page->settings->google_status === 1)
    <a href="{{ hybridAuth(route('user.login', [], false), 'google') }}" class="btn btn-google">
        Login with Google
    </a>
@endif

@if(!empty($page->settings->facebook_status) && (int)$page->settings->facebook_status === 1)
    <a href="{{ hybridAuth(route('user.login', [], false), 'facebook') }}" class="btn btn-facebook">
        Login with Facebook
    </a>
@endif

@if(!empty($page->settings->amazon_status) && (int)$page->settings->amazon_status === 1)
    <a href="{{ hybridAuth(route('user.login', [], false), 'amazon') }}" class="btn btn-amazon">
        Login with Amazon
    </a>
@endif