Introduction
Routes tell your Laravel app which code to run when someone visits a web address. They connect URLs to actions.
Routes tell your Laravel app which code to run when someone visits a web address. They connect URLs to actions.
Route::get('/url', function () { return 'Response'; });
Route::get('/', function () { return 'Welcome to my site!'; });
Route::post('/submit', function () { return 'Form submitted!'; });
Route::get('/about', function () { return view('about'); });
This route shows the text 'Hello, Laravel!' when you visit the home page URL.
<?php use Illuminate\Support\Facades\Route; Route::get('/', function () { return 'Hello, Laravel!'; });
Routes are defined in the routes/web.php file for web pages.
Use Route::post() for handling form data sent securely.
Always clear your route cache if routes don't update: run php artisan route:clear.
Routes connect URLs to code that runs when those URLs are visited.
Use Route::get() for simple page responses.
Routes help organize your app's web addresses clearly and simply.
Route::get('/home', function () { return 'Welcome Home'; });Route::get('/greet', function () { return 'Hello, Laravel!'; });Route::get('/contact', function { return 'Contact Page'; });Pass the test and this pattern moves unknown