Results: 1021
Imports CSS asset from
public/css/
folder
<link href="{{asset('css/app.css')}}" rel="stylesheet">
Pass parameter from controller to view
public function about() {
        $param1 = 'this is a parameter of about us page';
        return view('pages/about', compact('param1'));
    }
Content of
about
blade (the page receives and uses the passed parameter)
@section('cntnt')
    <h3>abt us {{$param1}}</h3>
@endsection
@extends
Extends layout file located at
resurces/views/layouts/app.blade.php
@extends('layouts.app')

@section('content')
     // "about us" page content goes here
@endsection
@yield
is mainly used to define a section in a layout. Content of
resources/views/layouts/app.blade.php
file
<body>
     @yield('content')
</body>
Content of
about
page that extends the above layout file
@extends('layouts.app')

@section('content')
     // "about us" page content goes here
@endsection
Only
about
returns view from route. Other routes fire
PagesController
appropriate methods
Route::get('/', 'PagesController@index');

Route::get('/about', function () {
    return view('pages.about');
});

Route::get('/services', 'PagesController@services');
Route::get('/contact', 'PagesController@contactUs');
PagesController
methods
class PagesController extends Controller
{
    public function index() {
        return view('pages.index');
    }
    public function about() {
        return view('pages/about');
    }
    public function services() {
        return view('pages/services');
    }
    public function contactUs() {
        return 'Under Construction';
    }
}
Returns text with the user name passed through request URL
Route::get('/users/{name}', function ($name) {
    return 'This is a user ' . $name;
});
Two parameters passed through the request URL
Route::get('/users/{name}/{id}', function ($name, $id) {
    return 'This is a user ' . $name .' with an id of '. $id;
});
Returns view located at
resources/views/pages/about.blade.php
Route::get('/hello', function () {
    return view('pages/about');
});
pages/about
is the same as
pages.about
Visiting
/hello
page returns
<h1>
Route::get('/hello', function () {
    return '<h1>Hello World</h1>';
});
Visiting
/hello
page returns text
Hello World
Route::get('/hello', function () {
    return 'Hello World';
});
Database configuration file is located at
config/database.php
Results: 1021