View
What is view?

All html page we save in resources->views. To save a file in Laravel use blade.

filename.blade.php

This was created by laravel template engine. we can also save file without using blade.php but problem is that we can't use any laravel services.

How to create blade template

View
Create html page and save in as demo.blade.php in resources->views

Code to create form 

<html>
<head>
<title>test1</title>
</head>
<body>
This is demo content
</body>
</html>

Routes

Route::get('newtesturl','newtestcontroller@show');

Controller

namespace ittrainingonlineHttpControllers;

use IlluminateHttpRequest;

use ittrainingonlineHttpRequests;
use ittrainingonlineHttpControllersController;

class newtestcontroller extends Controller
{
   
	public function show(){
		return view('demo');
	}
    
}
How to create Master Template and Main Page

How to create template

create master template
For this goto

<html>
<head>
<title>DemoLaravel - @yield('title')</title>
</head>
<body>
<div>
<a href="#">Home</a>|
<a href="#">About us</a>|
<a href="#">Contact us</a>|
<a href="#">Enquiry</a>|
<a href="#">Feedback</a>
</div>

@yield('content')
</body>
</html>

save page master.blade.php in resources->views>layout

Note layout folder is not a mandatory, but this is a good to coding

Now create Main template

@extends('layout.master')
@section('content')
<p>This is main page</p>
@endsection

Save page as main.blade.php in resources->views


Previous
Next