I have a suggestion... why not pass the domain as a parameter the way you would an unknown, article id for example /article/{id}
?
Try this:
Route::domain('{user}.xyz.com')->group(function () {
Route::get('/posts', [PostsController::class, 'view'])->name('posts');
});
In our PostsController
output the results...
class PostsController {
public function view ($user){
dd($user) //this will output the current user's subdomain name
}
}
Let me know if it works out for you.
* Be the first to Make Comment