alexa

Laravel 8 working with subdomain routing but its not working, I'm little confused about this anyone can answer

Laravel 8 working with subdomain routing but its not working, I'm little confused about this anyone can answer

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.


322 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry