Now we have to link the controller methods to the route. For this, add the following line to (web.php):
Route::get('/customers', 'CustomerController@showCustomers');
The controller name is separated from the method name with the @ character.
By default, Laravel uses the blade template engine. The view
function finds the necessary template in the resources/views
directory, makes the necessary changes to it and returns the text of the HTML page, at the same time passing to it any variables that are supplied in the template. You can find the description of the blade template syntax at .
The Template for Displaying Customers
The template for displaying customers looks like this:
@extends('example')
@section('title', 'Customers')
@section('body')
<h1>Customers</h1>
<p>
{!! $filter !!}
{!! $grid !!}
This template is itself inherited from the master template and also enables the menu template. The menu is quite simple and consists of three items: Customers, Products and Invoices.
<nav class="navbar main">
<div class="navbar-header">
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".main-collapse">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse main-collapse">
<li @if (Request::is('customer*'))
<li @if (Request::is('product*'))
class="active"@endif>{!! link_to("products", "Products") !!}</li>
<li @if (Request::is('invoice*'))
class="active"@endif>{!! link_to("invoices", "Invoices") !!}</li>
</ul>
</div>
</nav>
The master template enables css styles and JavaScript files with libraries.
@extends('example')
@section('title', 'Edit customer')
@section('body')
<p>
{!! $edit !!}