Skip to content

Routing

Benjamin Khalife edited this page Sep 16, 2020 · 3 revisions

The most basic Webrium routes accept a URI and a Closure, providing a very simple and expressive method of defining routes:

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

The Default Route Files

All Webrium routes are defined in your route files, which are located in the routes directory. The routes/web.php file defines routes that are for your web interface.

For most applications, you will begin by defining routes in your routes/web.php file. The routes defined in routes/web.php may be accessed by entering the defined route's URL in your browser. For example, you may access the following route by navigating to http://your-app.test/user in your browser:

Route::get('user', 'UserController->index');

Available Router Methods

The router allows you to register routes that respond to any HTTP verb:

Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::delete($uri, $callback);

you may even register a route that responds to all HTTP verbs using the any method:

Route::any('', function () {
    //
});
Clone this wiki locally