fix handle using asset for access css
This commit is contained in:
@@ -57,7 +57,7 @@ COPY --chown=www-data:www-data . /var/www/html
|
||||
RUN composer install --optimize-autoloader --no-dev --no-interaction
|
||||
|
||||
# Install Node.js dependencies and build assets
|
||||
RUN npm ci --only=production \
|
||||
RUN npm ci \
|
||||
&& npm run production \
|
||||
&& rm -rf node_modules
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\Menu;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -36,5 +37,20 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
$view->with('menus', $menus);
|
||||
});
|
||||
|
||||
// Force HTTPS in production if needed
|
||||
if (config('app.env') === 'production') {
|
||||
// Force the application URL to include port if specified
|
||||
$appUrl = config('app.url');
|
||||
if ($appUrl) {
|
||||
URL::forceRootUrl($appUrl);
|
||||
|
||||
// Parse URL to check if it's HTTPS
|
||||
$parsedUrl = parse_url($appUrl);
|
||||
if (isset($parsedUrl['scheme']) && $parsedUrl['scheme'] === 'https') {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,5 +53,9 @@ docker-compose -f docker-compose.prod.yml logs --tail=20
|
||||
echo "✅ Deployment completed!"
|
||||
echo "🌐 Application should be available at: http://localhost:8082"
|
||||
echo ""
|
||||
echo "🔍 Testing asset URLs:"
|
||||
echo "CSS: http://localhost:8082/assets/css/app.bundle.min.css"
|
||||
echo "JS: http://localhost:8082/assets/js/app.bundle.min.js"
|
||||
echo ""
|
||||
echo "To check logs: docker-compose -f docker-compose.prod.yml logs -f"
|
||||
echo "To check app logs: docker-compose -f docker-compose.prod.yml logs -f app"
|
||||
@@ -90,14 +90,14 @@
|
||||
<!--end::Fonts -->
|
||||
|
||||
<!--begin::Page Custom Styles(used by this page) -->
|
||||
<link href="{{ url('assets/css/demo1/pages/login/login-3.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('assets/css/demo1/pages/login/login-3.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Page Custom Styles -->
|
||||
|
||||
<!--begin::Global Theme Styles(used by all pages) -->
|
||||
<link href="{{ url('assets/css/app.bundle.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('assets/css/app.bundle.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Theme Styles -->
|
||||
|
||||
<link rel="shortcut icon" href="{{ url('assets/media/logos/ckb.jpeg') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/media/logos/ckb.jpeg') }}" />
|
||||
</head>
|
||||
<!-- end::Head -->
|
||||
|
||||
@@ -107,12 +107,12 @@
|
||||
<!-- begin:: Page -->
|
||||
<div class="kt-grid kt-grid--ver kt-grid--root">
|
||||
<div class="kt-grid kt-grid--hor kt-grid--root kt-login kt-login--v3 kt-login--signin" id="kt_login">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" style="background-image: url('{{ url('assets/media/bg/bg-3.jpg') }}');">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" style="background-image: url('{{ asset('assets/media/bg/bg-3.jpg') }}');">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-login__wrapper">
|
||||
<div class="kt-login__container">
|
||||
<div class="kt-login__logo kt-margin-b-0">
|
||||
<a href="#">
|
||||
<img src="{{ url('assets/media/logos/ckb.jpeg') }}" width="128">
|
||||
<img src="{{ asset('assets/media/logos/ckb.jpeg') }}" width="128">
|
||||
</a>
|
||||
</div>
|
||||
<div class="kt-login__signin">
|
||||
@@ -184,7 +184,7 @@
|
||||
<!-- end::Global Config -->
|
||||
|
||||
<!--begin::Global Theme Bundle(used by all pages) -->
|
||||
<script src="{{ url('assets/js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('assets/js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<!--end::Global Theme Bundle -->
|
||||
|
||||
<!--begin::Page Scripts(used by this page) -->
|
||||
|
||||
@@ -37,7 +37,7 @@ License: You must have a valid license purchased only from themeforest(the above
|
||||
<link href="{{ url('css/custom-web.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Custom Styles -->
|
||||
|
||||
<link rel="shortcut icon" href="{{ url('assets/media/logos/ckb.jpeg') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/media/logos/ckb.jpeg') }}" />
|
||||
<!-- begin::Global Config(global config for global JS sciprts) -->
|
||||
<script>
|
||||
var KTAppOptions = {
|
||||
@@ -62,12 +62,12 @@ License: You must have a valid license purchased only from themeforest(the above
|
||||
<!-- end::Global Config -->
|
||||
|
||||
<!--begin::Global Theme Bundle(used by all pages) -->
|
||||
<script src="{{ url('js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="//maps.google.com/maps/api/js?key=AIzaSyBTGnKT7dt597vo9QgeQ7BFhvSRP4eiMSM" type="text/javascript"></script>
|
||||
<!--end::Global Theme Bundle -->
|
||||
|
||||
<!--begin::Common Script -->
|
||||
<script src="{{ url('js/init.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('js/init.js') }}" type="text/javascript"></script>
|
||||
<!--end::Common Scripts -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.3.0/dist/chart.umd.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2"></script>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-fit dropdown-menu-right dropdown-menu-anim dropdown-menu-top-unround dropdown-menu-xl">
|
||||
<!--begin: Head -->
|
||||
<div class="kt-user-card kt-user-card--skin-dark kt-notification-item-padding-x" style="background-image: url('{{ url('assets/media/misc/bg-1.jpg') }}')">
|
||||
<div class="kt-user-card kt-user-card--skin-dark kt-notification-item-padding-x" style="background-image: url('{{ asset('assets/media/misc/bg-1.jpg') }}')">
|
||||
<div class="kt-user-card__name">
|
||||
{{ Auth::user()->name }}
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@ License: You must have a valid license purchased only from themeforest(the above
|
||||
<link href="{{ url('css/custom-web.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Custom Styles -->
|
||||
|
||||
<link rel="shortcut icon" href="{{ url('assets/media/logos/ckb.jpeg') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/media/logos/ckb.jpeg') }}" />
|
||||
|
||||
<link href="{{ asset('css/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
@@ -116,12 +116,12 @@ License: You must have a valid license purchased only from themeforest(the above
|
||||
<!-- end::Global Config -->
|
||||
|
||||
<!--begin::Global Theme Bundle(used by all pages) -->
|
||||
<script src="{{ url('js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="//maps.google.com/maps/api/js?key=AIzaSyBTGnKT7dt597vo9QgeQ7BFhvSRP4eiMSM" type="text/javascript"></script>
|
||||
<!--end::Global Theme Bundle -->
|
||||
|
||||
<!--begin::Common Script -->
|
||||
<script src="{{ url('js/init.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('js/init.js') }}" type="text/javascript"></script>
|
||||
<!--end::Common Scripts -->
|
||||
|
||||
<!--end::Common Scripts -->
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-fit dropdown-menu-right dropdown-menu-anim dropdown-menu-top-unround dropdown-menu-xl">
|
||||
<!--begin: Head -->
|
||||
<div class="kt-user-card kt-user-card--skin-dark kt-notification-item-padding-x" style="background-image: url('{{ url('assets/media/misc/bg-1.jpg') }}')">
|
||||
<div class="kt-user-card kt-user-card--skin-dark kt-notification-item-padding-x" style="background-image: url('{{ asset('assets/media/misc/bg-1.jpg') }}')">
|
||||
<div class="kt-user-card__name">
|
||||
{{ Auth::user()->name ?? '' }}
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div id="kt_header_mobile" class="kt-header-mobile kt-header-mobile--fixed pageNotPrint">
|
||||
<div class="kt-header-mobile__logo">
|
||||
<a href="demo1/index.html">
|
||||
<img alt="Logo" src="{{ url('assets/media/logos/logo-landscape-white.png') }}" width="92" />
|
||||
<img alt="Logo" src="{{ asset('assets/media/logos/logo-landscape-white.png') }}" width="92" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="kt-header-mobile__toolbar">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="kt-aside__brand kt-grid__item " id="kt_aside_brand">
|
||||
<div class="kt-aside__brand-logo">
|
||||
<a href="{{ route('dashboard') }}">
|
||||
<img alt="Logo" src="{{ url('assets/media/logos/ckb.jpeg') }}" width="92" />
|
||||
<img alt="Logo" src="{{ asset('assets/media/logos/ckb.jpeg') }}" width="92" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
<!--end::Fonts -->
|
||||
|
||||
<!--begin::Page Custom Styles(used by this page) -->
|
||||
<link href="{{ url('assets/css/demo1/pages/login/login-3.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('assets/css/demo1/pages/login/login-3.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Page Custom Styles -->
|
||||
|
||||
<!--begin::Global Theme Styles(used by all pages) -->
|
||||
<link href="{{ url('assets/css/app.bundle.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('assets/css/app.bundle.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Theme Styles -->
|
||||
|
||||
<link rel="shortcut icon" href="{{ url('assets/media/logos/bengkel.ico') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/media/logos/bengkel.ico') }}" />
|
||||
</head>
|
||||
<!-- end::Head -->
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
<!-- begin:: Page -->
|
||||
<div class="kt-grid kt-grid--ver kt-grid--root">
|
||||
<div class="kt-grid kt-grid--hor kt-grid--root kt-login kt-login--v3 kt-login--signin" id="kt_login">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" style="background-image: url('{{ url('assets/media/bg/bg-3.jpg') }}');">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" style="background-image: url('{{ asset('assets/media/bg/bg-3.jpg') }}');">
|
||||
<div class="kt-grid__item kt-grid__item--fluid kt-login__wrapper">
|
||||
<div class="kt-login__container">
|
||||
<div class="kt-login__logo kt-margin-b-0">
|
||||
<a href="#">
|
||||
<img src="{{ url('assets/media/logos/bengkel-logo.png') }}" width="128">
|
||||
<img src="{{ asset('assets/media/logos/bengkel-logo.png') }}" width="128">
|
||||
</a>
|
||||
</div>
|
||||
<div class="kt-login__signin">
|
||||
@@ -107,11 +107,11 @@
|
||||
<!-- end::Global Config -->
|
||||
|
||||
<!--begin::Global Theme Bundle(used by all pages) -->
|
||||
<script src="{{ url('assets/js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('assets/js/app.bundle.min.js') }}" type="text/javascript"></script>
|
||||
<!--end::Global Theme Bundle -->
|
||||
|
||||
<!--begin::Page Scripts(used by this page) -->
|
||||
<script src="{{ url('assets/js/demo1/pages/login/login-general.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ asset('assets/js/demo1/pages/login/login-general.js') }}" type="text/javascript"></script>
|
||||
<!--end::Page Scripts -->
|
||||
</body>
|
||||
<!-- end::Body -->
|
||||
|
||||
Reference in New Issue
Block a user