Achieve the World’s Most Prestigious Certifications and Unlock Top-Paying Careers! Get Certified in the Industry’s Leading Programs Today.
🚀 DevOps Certified Professional 🚀 SRE Certified Professional 🚀 DevSecOps Certified Professional 🚀 MLOps Certified Professional
📅 Starting: 1st of Every Month 🤝 +91 8409492687 | 🤝 +1 (469) 756-6329 🔍 Contact@DevOpsSchool.com

LARAVEL ROUTING

Laravel

All Laravel routes are define in route files , which are located in the route directory ,These file are automatically loaded by the framework.

The most basic Laravel routes accept a URI and a closure, providing a very simple and expressive method of defining routes and behavior without complicated routing configuration files:

Basic Routes

Syntax:-

Route::get(‘URI’,closer/callback);

Ex :-

Route::get(‘/about’,function()

{

return “hello world”;

});

Routes Parameter

Syntax :-

Route::get(‘uri/{parameter}’,function($para)

{

return $para;

});

Example

Route::get(‘user/{user_id}’,function($user_id)

{

return $user_id;

});

Multiple Parameter Routes

syntax :-

Route::get(‘uri/{parameter}/uri/{para}’, function($parameter, $para)

{

return $parameter $para;

});

Example:-

Route::get(‘user_name/{U_name}/user_id/{U_id}’,function($name $id)

{

return $name $id;

});

Redirect Routes

Syntax:-

Route::redirect(‘from’,’to’);

Example:-

Route::redirect(‘login’,’dashboard’);

Thanku