Before you can visit any page or post of your laravel application you will have to specifies the route for individual static page or dynamic post.
Laravel determines the way to control the the contents by assigning them to a controller.Each Controller in laravel consist of different function that controls the various data on the type of methods such as-:
In order to Pass the requested data to the specified controller we will have to define what is called Routes
The simplest route that can be define is:
In above route ‘/home’ is the url that appears to user something like “http://www.yourdomain.com/home”
Route::get() is defined for the GET method similarly we can define something like Route::post(),Route::put(),Route::delete() for POST, PUT and DELETE request
The Above route says that when user visits the url ” http://www.yourdomain.com/home” return the content inside the welcome.blade.php
If you want to to go to controller through route you can define something like
where “pagecontroller” is the name of controller and “index” is the method defined inside the pagecontroller
Suppose that you are working on big project which consists of hundreds of form that it might become a heavy task to define individual route for the CRUD(Create-Read-Update-Delete) functionality.
Resource routes comes in handy when you need to define the controller that handles the Crud functionality.
To generate resourceful controller : php artisan make:controller –resource;
To define the route for resource controller: Route::resource(‘form’,’formController’);
The above resource would define the List of following individual route which you would have probably defined if working individually: