Problem with route in Laravel; my page does not access the bootstrap files that are on the layout page
I would like a fork, I'm starting with laravel 6 and I'm having the following problem;
I have a layout page inside the "views>layouts" folder which is called " admin.blade.php":
In it are my bootstrap and jQuery files and etc. Page " admin.blade.php":
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Adcionando dependencias -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<title> @yield('title') </title>
</head>
<header >
<!-- Menu da página -->
</header>
<body>
<div class="container">
@yield('content')
</div>
</body>
<footer>
<!-- Rodapé da página -->
</footer>
</html>
Here are my routes:
//Admin
Route::get('/admin', 'AdminController@index');
Route::get('/admin/usuarios', 'UsuariosController@index');
The routes direct to the controller which directs to the proper ones file. When I access the admin module index page inside " views > admin > index.blade.php " extending the layout page:
@extends('layouts.admin')
@section('title')
Index
@endsection
@section('content')
<!-- Corpo da página -->
@endsection
In Google Chrome resources the search directory for bootstrap files is:
This way I can access the bootstrap files and everything goes well, but when I try to access the user index of the admin module, in the following directory " views>admin>users > index.blade.php", similarly extending the admin layout page, the search directory for bootstrap files is:
With this "admin" in the middle of the request Url, this way I can no longer access the bootstrap files and the page loses the stylization.
I would like to know why this problem is and how to solve it. Hugs now! ;)
1 answers
Attempts to call bootstrap and jQuery files using a laravel helper named asset:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Adcionando dependencias -->
<!-- CSS -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<!-- JS-->
<script src="{{ asset('js/app.js') }}"></script>
<title> @yield('title') </title>
</head>
<header >
<!-- Menu da página -->
</header>
<body>
<div class="container">
@yield('content')
</div>
</body>
<footer>
<!-- Rodapé da página -->
</footer>
</html>