how to use Basic Routing in laravel

Answer

we can define most of the routes for your application in the app/Http/routes.php file, which is loaded by the App\Providers\RouteServiceProvider class. The most basic Laravel routes simply accept a URI and a Closure:

Basic GET Route

Route::get('/', function()
{
    return 'Hello World';
});

Other Basic Routes

Route::post('foo/bar', function()
{
    return 'Hello World';
});

Route::put('foo/bar', function()
{
    //
});

Route::delete('foo/bar', function()
{
    //
});

Registering A Route For Multiple Verbs

Route::match(['get', 'post'], '/', function()
{
    return 'Hello World';
});

Registering A Route That Responds To Any HTTP Verb

Route::any('foo', function()
{
    return 'Hello World';
});

Often, you will need to generate URLs to your routes, you may do so using the url helper:

$url = url('foo');

All laravel Questions

Ask your interview questions on laravel

Write Your comment or Questions if you want the answers on laravel from laravel Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---