+1 vote
in Laravel by
How to define routes in Laravel?

1 Answer

0 votes
by

Laravel Routes are defined in the routes file in routes/web.php for web application routes. Routes can be defined using Illuminate\Support\Facades\Route and calling its static methods such as to get, post, put, delete, etc.

use Illuminate\Support\Facades\Route;

Route::get('/home', function () {

    return 'Welcome to Home Sweet Home';

});

A typical closure route looks like the above, where we provide the URI and the closure function to execute when that route is accessed.

Route::get('/hello', 'HomeController@index');

Another way is like above, we can directly give the controller name and the method to call, this can again be resolved using Service Container.

Related questions

0 votes
asked Oct 22, 2023 in Laravel by john ganales
0 votes
asked Oct 17, 2023 in Laravel by Robindeniel
+1 vote
+1 vote
asked Jun 27, 2023 in Laravel by SakshiSharma
0 votes
asked Jun 27, 2023 in Laravel by Robindeniel
...