Route::domain('{user}.xyz.com')->group(function () {
Route::get('/posts', [PostsController::class, 'view'])->name('posts');
});
//Controller
class PostsController {
public function view ($user){
dd($user) //this will output the current user's subdomain name
}
}