How do I require authentication for a set of routes associated with a subdomain?



How do I require authentication for a set of routes associated with a subdomain?..

Answer / Girish Candra Sharma

To require authentication for routes associated with a subdomain, you can create a new route group and apply the `auth` middleware to it. Here's an example:nn```phpn// app/Http/routes.phpnuse IlluminateSupportFacadesRoute;nnRoute::domain('{subdomain}.example.com', function () {n Route::middleware(['auth'])->group(function () {n // Your routes heren });n});n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

Who are Manually Authenticating Users in Laravel ?

2 Answers  


What is a recursive helper function?

1 Answers  


What is an observer?

1 Answers  


What are advantages of laravel?

1 Answers  


Explain auth.

1 Answers  


What is auth? How is it used?

1 Answers  


List some default packages provided by laravel 5.6?

1 Answers  


How do I populate my database with sample data?

1 Answers  


What is auth api laravel?

1 Answers  


How to launch vagrant box?

1 Answers  


What is url in laravel?

1 Answers  


What is database migration. How to create migration via artisan?

1 Answers  


Categories