Skip to content

Commit 53351c7

Browse files
fix(frontend): Add load_asset function to switch between http and https based on environments
1 parent 4edbd71 commit 53351c7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

app/Http/helpers.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function load_asset($asset_url)
4+
{
5+
return ( env('APP_ENV') === 'production' ) ? secure_asset($asset_url) : asset($asset_url);
6+
}

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
"classmap": [
3737
"database"
3838
],
39+
"files": [
40+
"app/Http/helpers.php"
41+
],
3942
"psr-4": {
4043
"App\\": "app/"
4144
}

resources/views/layouts/master.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.12.0/bootstrap-social.min.css">
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.css">
1111
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/fonts/fontawesome-webfont.ttf">
12-
<link rel="stylesheet" href="{{ asset('css/main.css') }}">
12+
<link rel="stylesheet" href="{{ load_asset('css/main.css') }}">
1313
</head>
1414
<body>
1515
@include('layouts.partials.navbar')

0 commit comments

Comments
 (0)