I want to create in Laravel something like this structure:
- The main template file: views / index.blade.php, which contains within it sections
head(meta tags),contentand sections for displaying modules (widgets) (for example,@yield('content'). - Template files for each of the pages: views / pages / ..., where each of the pages describes the sections specified in the "index.blade.php".
- Widget files: views / widgets / ..., which describes the markup of all widgets.
How is this implemented on Laravel? For example, the controller displays the mapping for a specific page as follows:
return view('index'); Thus, I will display the common template file "index.blade.php". How to make so that, for example, a common template file is displayed on each page, and the text inside the head and content areas is generated by files inside the "pages" folder?
And the second question: is it correct in this case to connect widgets (modules) using the @include directive inside the file of a specific page (views / pages)? Something like that:
@section('widgets') @include('widgets.miniprofile') @stop The widgets section itself would be described inside the main "index.blade.php" (yield).