I am developing a web with Laravel and I need to pass the data that comes from a controller to a module called seciones.blade.php
that is in a folder called includes
, so that the structure is like this:
includes/secciones.blade.php
index.blade.php
In the file index.blade.php
I have included the file in question with Laravel Blade in the following way:
<!DOCTYPE html>
<html lang="es">
<head>
<title>Innova Soluciones | Home </title>
</head>
<body>
@include('includes/secciones')
</body>
I have the following path that takes me to a Controller named PrincipalController@index
:
Route::get('/', 'PrincipalController@index');
PrincipalController@index
executes the index
method that what it does is to return the view where the includes/secciones.blade.php
module is included in the following way:
class PrincipalController extends Controller
{
public function index() {
return view('index');
}
}
Inside the file includes/secciones.blade.php
I have a static menu that I want to replace it with the data that is the database:
<section class="seccion_categorias_items">
<div class="item">
<label class="item_img"><img src="img/logos/svg/zapatos.svg"></label>
<h1 class="item_titulo">Innovate Zapatos </h1>
<a class="item_link" href="/"></a>
</div>
<!-- ... las demas opciones aquí -->
</section>
The process of passing the controller data to this module that is outside or in another location where the view index.blade.php
is the one that I do not know, since the method index
of PrincipalController
would only return the% view % co with the ESA data view and not the index.blade.php
module.
I hope you have explained to me, if not, I ask you to kindly ask, I appreciate your contributions or suggestions.