Before Start PHP Laravel you must need to good knowledge on PHP Programming and oviously on Object Oriented Progamming

Applications take after the customary MVC(Model View Controller) outline design:

MVC Framework Struture –

Controllers : This Controller do handle user requests and retrieve data, by leveraging Models data overall framework. Converts it to commands for the model or view
Models: Model to do interact with Server database and retrieve objects,information,manages the data, logic and rules of the application
Views: to do yield representation of data. Example – a graph or a chart. generates output of the project

Routes to appropriate Laravel Applicatioin Development Structure

  • ● ALL solicitations coming to Laravel are steered
  • ● Front controller example is taken care of by index.php
  • ● Routing is taken care of by application/routes.php
  • ● We will cover just some fundamental things, enough for down to earth task
  • ● Laravel additionally empowers things like area directing, course prefixing, secure directing, and so forth.

Building an Example Laravel application

Now we are going to move through the procedure of building the begin of an example Laravel 5 application with all the MVC segments — a model, a perspective view, and a controller.

In this way, suppose you needed to assemble an application managing autos

We want to start by creating laravel model file which called a Person.

  • Laravel accompanies an awesome, worked in charge line interface, the Artisan CLI, which furnishes you with a pack of valuable orders to help you construct your application.
  • Before dispatching your Homestead surroundings, you should introduce VirtualBox and Vagrant. Both of these product bundles give simple to-use visual installers for all well known working frameworks.

Models are all stored in the main app directory, so that command will generate an app/Person.php model file with the following code:

Explanation how to work Model in Laravel:

In Laravel’s Model functionality, Created a empty model class, Laravel will accept that this model is connected with a database table named Person.

And, Another command supplying that –migration alternative while producing the model, Laravel likewise created a database movement document for making that autos database table. The migration file is located at [timestamp]_create_cars_table.php which following Coding Structure:

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

To make a few additional columns to, say, store the cars’ make, model, and production date into Migration Database:

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.


In Laravel, a kind of article —, for example, a Person, for this situation — is alluded to as an asset.

Since it’s so regular to assemble applications around assets, you can create an asset controller — a controller to handle all solicitations identified with an asset — utilizing another straight forward Artisan Command:

This Controller File will generate directotry on : app/Http/Controllers/PersonController.php

Laravel Routes Configaration

Request Type Path Action Route Name
GET /cars index person.index
GET /cars/create create person.create
POST /person store
GET /person/{person} show
GET /person/{person}/edit edit person.edit
PUT/PATCH /person/{person} update person.update
DELETE /person/{person} destroy person.destroy

Route Procedure Person Struture Table:

How to Work Laravel Controller ‘Show’ Action with Person ID:

Example that, URL view the person with id=5 must be display into browser page url –

PHP Laravel view documents are all put away in the resources/views Folder. we can also make subfolders on subdirectory

Laravel View function work by name and view file called by named .blade.php.

Implement the Show Person page, Laravel file directory called – view root directory(resources/views/show.blade.php)  and subdirectory (resources/views/person/show.blade.php)