I am building an admin interface for a web application.
The full directory structure is as follows:
|-main
| |- app
| |- bootstrap
| |- config
| |- database
| |- resources
| | -views
| |-admin
| |-templates
| |-template.blade.php
| |-utils
| |-foot.blade.php
| |-head.blade.php
| |-views
| |-index.blade.php
| |-users.blade.php
| |- routes
| |- web.php
|
|-public_html
| |-admindash
| |-dist
| |-css
| |-img
| |-js
| |-plugins
| |-bootstrap
| |-fontawesome-free
| |-jquery
The head.blade file looks something close to this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>...</title>
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="../admindash/plugins/fontawesome-free/css/all.min.css">
.
.
some more css here
.
.
</head>
<body class="hold-transition sidebar-mini">
foot.blade:
<script src="../admindash/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script
.
.
.
More scripts here
.
.
.
</body>
</html>
The template blade then includes both of these and yields a section for child blades to populate:
@include('admin.utils.head')
<div class="wrapper">
<!-- Main content -->
<div class="content">
@yield('maincontent')
</div>
<!-- /.content -->
</div>
@include('admin.utils.foot')
And then with the index and users blades in views folders I do the following
@extends('admin.templates.template')
@section('maincontent')
.
.
main html goes here
.
.
@endsection
All works fine to this point, I define my Controller functions which return the blade files and my web.php routes I define as well:
//Admin Dashboard routes
Route::group(['namespace' => 'Admin'], function (){
Route::get('/admin/dashboard', 'DashboardController@adminHome')->name('AdminDashboard');
Route::get('/admin/maintenance/users', 'DashboardController@displayUsers')->name('AdminDashboardUsers');
});
When I load the route /admin/dashboard the styles render perfectly, no errors. Tricky part is when I render /admin/maintenance/users then it all goes off, I get a skeleton html file with an error in console that the css resources could not be loaded.
NOTE: the css and js files are all located in a public_html folder outside of the project folder.