Tags

,

Caveat:

This post is about the old Laravel architecture. For the latest one please consult my new books, either on Leanpub or on Amazon.

Just published! My new book on Laravel 5.7.*: Middleware, Authentication, Authorization Explained: How to Authenticate a company, projects and tasks management application.

Just published! My new book on Beginning Ethical Hacking with Kali Linux: Computational Techniques for Resolving Security Issues.

Let us start with basic routing. If you are absolute beginner, don’t worry. Just remember, in the ‘app/Http’ folder there is a file called ‘routes.php’ where primarily the ‘request’ and ‘response’ mechanism is settled. We will discuss ‘request’ and ‘response’ architecture in detail later. But as a beginner, to start with you remember that HTTP protocol or grossly web is based on REST architecture and ‘request’ and ‘response’ cycle is the essence of the whole thing. When we say this, it is bit simplified but we will come back to this point once again.

We would like to advance our primary knowledge. We want to make some output. So forget everything and concentrate on the ‘routes.php’ file. When your application is launched, the ‘routes.php’ file looks something like this:
//code starting
<?php
Route::get(‘/’, function () {
return view(‘welcome’);
});
//code ended
Here ‘Route’ is a class that has a static method ‘get’ that returned a ‘view’ method which presents a page. When a user visits the home page he is taken to the ‘welcome’ page. Look at the code, there is an anonymous function also.

Advertisements