The most part of Laravel is usage of layout. It helps you to design a better application. You can create a layout and use that for view pages. Below is a good & simple example how you can create and use layouts.
At first create file named "test.blade.php" under "resources/views/layouts" folder with following contents:
The use of the layout file would be as like (from any resources blade file):
At first create file named "test.blade.php" under "resources/views/layouts" folder with following contents:
<!DOCTYPE html>
<html>
<head>
<title>Title - @yield('title')</title>
</head>
<body>
<section>
@yield('content')
</section>
<section>
@yield('pageScript')
</section>
</body>
</html>
The use of the layout file would be as like (from any resources blade file):
@extends('layouts.test') //This line will include layout file
@section('title', 'Title of the page') //Set title of the page
@section('content') //Start content of the page
Html content goes here
@stop //End content of the page
@section('pageScript') //Start javascript of the page
<script src="{{ asset('/js/some-js-file.js') }}"></script>
<script>
$(document).ready(function () {
});
</script>
@stop //End javascript of the page
What Is Laravel Framework
ReplyDeleteLaravel PHP Framework