randolphrrl's avatar

Backend to Frontend View or Section

Hello!

I finished the development of my backend. The view files are in the "resources / views / software" folder and now I would like to put some pages that created welcome.blade.php file that is in the frontend. How would I do this procedure? Could you give me a tutorial or give me a hand in this problem?

0 likes
5 replies
xmarks's avatar

Well you could easily just as well create a directory: resources / views / frontend where you can add all your front-end View Files.

You would also create here something like: resources / views / frontend / layouts / master.blade.php which would be your new Front End layout - if you wish to have a different design for the Front End.

Here you would load a different CSS / JS for the new layout. All your new Front End Views would reference this as the Master Layout. All your Controllers would also reference Views from this Folder Group.

It's quite straight-forward. Are you having trouble with something in particular?

1 like
randolphrrl's avatar

I have three different directories in my CRUD using an admin panel using Auth:

resources / views / software resources / views / infra resources / views / colocation

I would like to use a foreach of each view I have on the frontend page, such as showing a software registered in the bank, information on the colocation and etc. My frontend is in:

resources / views / welcome.blade.php

randolphrrl's avatar

I'm sorry, but I do not think I'm expressing correctly. I have a simple crud made with Laravel's Auth. I have the following Views:

resources / views / software / index.blade.php (where I own the section top)
resources / views / infra / index.blade.php (where I own the section mid)
resources / views / colocation / index.blade.php (where I own the section bot)

What I would like to do is to add within the resources / views / welcome.blade.php file an @yield of each view that was created, for example:

<! DOCTYPE html>
<html>
<body>
<div class = "top">
@yield ('software-top')
</ div>

<div class = "mid">
@yield ('infra-mid')
</ div>

<div class = "bot">
@yield ('colocation-bot')
</ div>

</ body>
</ html>

so I'm going to use data that has been saved in three different tables in a single view. Is there such a possibility?

pardeepkumar's avatar

For Example : Your route file

Route::get('/', function()
{
    return View::make('pages.home');
});
Route::get('about', function()
{
    return View::make('pages.about');
});
Route::get('projects', function()
{
    return View::make('pages.projects');
});
Route::get('contact', function()
{
    return View::make('pages.contact');
})

Template.blade.php

html>
<head>
    @include('includes.head')
</head>
<body>
<div class="container">

    <header class="row">
        @include('includes.header')
    </header>

    <div id="main" class="row">

            @yield('content')

    </div>

    <footer class="row">
        @include('includes.footer')
    </footer>

</div>
</body>
</html>

pages/home.blade.php

@extends('layouts.default')
@section('content')
    i am the home page
@stop

Please or to participate in this conversation.