Using master pages for layouts using Blade Templating in Laravel 5

Laravel 5 Blade Templating allows you to create master pages and then inherit this layout in all other pages in which you want it to be inherited. In order to create we have to follow some steps as :

adding route (routes.php)


| Application Routes
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.

Route::get('/', 'WelcomeController@index');

// this is the auth controller
Route::resource('auth', 'Authors_Controller@index');

controller (Authors_Controller.php)

<?php namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

class Authors_Controller extends Controller {

	 * Display a listing of the resource.
	 * @return Response
	public function index()
		// here we are defining array
		return view('authors.index', array(
										'name' => 'abc',
										'company' => 'abcCompany',
										'address' => 'xyz'

Blade Template (default.blade.php)

<meta charset="utf-8">
	<div id="header" style="background-color: yellow;">
		Header content

View file (index.blade.php)

<!-- including layout -->

<!-- title -->
Hello Title

<!-- content -->
<h1>Data display</h1>

{{ $name }} <br>
{{ $company }} <br>
{{ $address }} <br>





You may also like...