lundi 12 septembre 2016

How to define a "Master Layout" in Laravel 5.1

I'm starting to use Laravel 5.1 from 4.2 and I have a question about the definition of layouts in the controller.

In 4.2 I have this

private $layout = 'layouts.master';

    public function showWelcome()
    {
        $this->layout->content =  View::make('home');
    }

So when the view load, in the

@yield('section')

of the "master.blade.php" in the layouts folder will appears the view "Home"

I search how to use this in 5.1 and I see that the asignation of the layout.masters as been removed, but I can't see the new usage anywhere.

Now in 5.1 I have

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use View;

class HomeController extends BaseController {

    public function showWelcome()
    {
        return view('home');
    }
}

How Can I say to the function showWelcome that it have to yield the content with the view?

Sorry for my bad english.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire