Files
kaunter/app/helpers.php
T
ismailmasseran d60dd8bf39
Build Docker Image / build-frontend (push) Successful in 38s
Explore/ismail (#15)
Co-authored-by: ISMAIL MASSERAN <topaz@Mac.dlinkrouter.local>
Co-authored-by: ISMAIL MASSERAN <topaz@ISMAILs-Macbook.local>
Co-authored-by: nurafrinaalimi16 <nurafrinaalimi16@gmail.com>
Reviewed-on: #15
2026-09-06 12:41:58 +08:00

16 lines
523 B
PHP

<?php
if (!function_exists('api_url_for_browser')) {
/**
* Base URL for JavaScript in the browser, derived from API_URL (config api.url).
* Docker dev often uses host.docker.internal for PHP→host; browsers may not resolve it.
* Same host-mapped port is reachable at 127.0.0.1. Production URLs are unchanged.
*/
function api_url_for_browser(): string
{
$url = rtrim((string) config('api.url'), '/');
return str_ireplace('host.docker.internal', '127.0.0.1', $url);
}
}