From ed48972985d4bdc5b974a16c961bae103ecac7d1 Mon Sep 17 00:00:00 2001 From: Shahrukh Akhtar Date: Sun, 18 Aug 2024 02:51:28 +0500 Subject: [PATCH] Update routes.blade.md Example Updated --- source/docs/v3/routes.blade.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/docs/v3/routes.blade.md b/source/docs/v3/routes.blade.md index 17c44f9..708b5a0 100644 --- a/source/docs/v3/routes.blade.md +++ b/source/docs/v3/routes.blade.md @@ -14,6 +14,25 @@ You may register central routes in `routes/web.php` or `routes/api.php` like you > Note: Since Laravel 11, there isn't a `RouteServiceProvider`, so you can instead wrap your central routes in a `Route::domain(...)->group(...)` call. See the quickstart guide for an example. +```php +// web.php +Route::domain('saas.test')->group(function() { + Route::get('/dashboard', function () { + return view('dashboard'); + })->middleware(['auth', 'verified'])->name('dashboard'); + + Route::middleware('auth')->group(function () { + Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit'); + Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update'); + Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); + + Route::resource('tenents', TenantController::class); + }); + + require __DIR__.'/auth.php'; +}); +``` + You don't want central routes — think landing pages and sign up forms — to be accessible on tenant domains. For that reason, register them in such a way that they're **only** accessible on your central domains: ```php