Skip to content

Commit 11fb514

Browse files
Added function to get the Base URL of the application
1 parent 041c79c commit 11fb514

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

helpers.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ function sayHello()
1313
return "index";
1414
}
1515

16+
/**
17+
* This function returns the Application URL
18+
* for the given folder location
19+
* @param String $location Folder Location
20+
* @return String Folder URL
21+
*/
22+
function baseUrl($location)
23+
{
24+
$url = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
25+
$url .= $_SERVER['HTTP_HOST'];
26+
return $url.$location;
27+
}
28+
1629
/**
1730
* This function is simply like an alias
1831
* to getenv function

views/template.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Akshay | @yield('page_title')</title>
88

99
<!-- Bootstrap CSS -->
10-
<link rel="stylesheet" href="./css/bootstrap.min.css">
10+
<link rel="stylesheet" href="{{ baseUrl('/css/bootstrap.min.css') }}">
1111

1212
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
1313
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@@ -21,6 +21,6 @@
2121
<!-- jQuery -->
2222
<script src="//code.jquery.com/jquery.js"></script>
2323
<!-- Bootstrap JavaScript -->
24-
<script src="./js/bootstrap.min.css"></script>
24+
<script src="{{ baseUrl('/js/bootstrap.min.js') }}"></script>
2525
</body>
2626
</html>

0 commit comments

Comments
 (0)