Laravel Routing GET and POST Route parameters controller
In this Post We Will Explain About is Laravel Routing GET and POST Route parameters controller With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Simple Basic Routing using LaravelExample
In this post we will show you Best way to implement laravel route parameters controller, hear for php – How to route GET and POST in Laravelwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
Available Router Methods
There are the following list of the Laravel Route methodes
1.Route::get($uri, $callback);
2.Route::post($uri, $callback);
3.Route::put($uri, $callback);
4.Route::patch($uri, $callback);
5.Route::delete($uri, $callback);
6.Route::options($uri, $callback);
Open routes.php file. and simple The file is located in /app/Http/
Add the simple following code to routes.php
Laravel Route GET Route
Route::get('/', function() { //return message return 'welcome - infinityknow.com - Good Luck.!!'; });
Laravel Route POST Route
Route::post('home/admin', function() { //return message return 'welcome - infinityknow.com - Good Luck.!!'; });
Laravel Route Registering A Route For Multiple Verbs
Route::match(array('GET', 'POST'), '/', function() { //return message return 'welcome - infinityknow.com - Good Luck.!!'; });
Laravel Route Registering A Route Responding To Any HTTP Verb
Route::any('home', function() { //return message return 'welcome - infinityknow.com - Good Luck.!!'; });
Laravel Route Forcing A Route To Be Served Over HTTPS
Route::get('home', array('https', function() { //return must be https return 'here simple or Must be over HTTPS'; }));
Laravel Route using the URL::to method:
E-junkie: Sell digital downloads online
E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!
Also see:
$get_url = URL::to('home');
Laravel Route : – Route Parameters
Route::get('product/{id}', function($id) { //return id return 'Products '.$id; });
Laravel Route – Optional Route Parameters
Route::get('product/{name?}', function($name = null) { //return name return $name; });
Laravel Route – Optional Route Parameters With Defaults
Route::get('product/{name?}', function($name = 'laptop') { //return name return $name; });
Laravel Route – Regular Expression Route Constraints
Route::get('product/{name}', function($name) { // your PHP some code here with where conditions }) ->where('name', '[A-Za-z]+'); Route::get('product/{id}', function($id) { // your PHP some code here with where conditions }) ->where('id', '[0-9]+');
Laravel Route – Passing An Array Of Wheres
Route::get('product/{id}/{name}', function($id, $name) { //your PHP some code here with where }) ->where(array('id' => '[0-9]+', 'name' => '[a-z]+'))
Laravel Route – Defining Global Patterns
//your pattern Route::pattern('id', '[0-9]+'); //basic routings Route::get('product/{id}', function($id) { // your PHP some code here Like as a Only called if "{id}" is numeric. });
Laravel Route – Accessing A simple Route Parameter Value : use the Route::input method:
Route::filter('home', function() { if (Route::input('id') == 1) { // your PHP some code here } });
I hope you have Got What is difference between laravel get and post route And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.