Home /Laravel /Displaying variables in a blade template

Displaying variables in a blade template

In this section, we will define a name variable and pass it to our blade template view

  1. open /app/Http/routes.php
  2. modify the blade route to the following
Route::get(‘blade’, function () {

return view(‘page’,array(‘name’ => ‘The Raven’));


We will now update pages.blade.php is display the variable

  1.  Open /resources/views/page.blade.php
  2. Update the contents to the following

@section(‘title’, ‘Page Title’)



This is appended to the master sidebar.




This is my body content.


• {{$name}} double opening curly braces and double closing curly braces are used to display the value of $name variable.

Leave a Reply