xxxxxxxxxx
use Illuminate\Support\Facades\Route;
Route::get('/greeting', function () {
return 'Hello World';
});
xxxxxxxxxx
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
xxxxxxxxxx
Route::get('user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
xxxxxxxxxx
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
xxxxxxxxxx
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
Route::match(['get', 'post'], '/', function () {
// ...
});
Route::any('/', function () {
// ...
});
//By default, Route::redirect returns a 302 status code. You may customize
//the status code using the optional third parameter:
Route::redirect('/here', '/there');
//you may use the Route::permanentRedirect method to return a 301 status
//code
Route::permanentRedirect('/here', '/there');