PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Unsolved

i need tutorial or explain with code

freeadsy

May 6th, 2023 02:27 AM

i want when user register new account creat his own domain and user can direct his custom domain like www.userdomain.com to user.laravelproject.com

i need tutorial or explain with code

thanks

superdev

May 6th, 2023 05:29 PM

Hi, you can use the Route::domain function in Laravel.

You can find an example at https://github.com/spatie/spatie.be/blob/main/routes/web.php

You can find the documentation on Route::domain at https://laravel.com/docs/10.x/routing#route-group-subdomain-routing

Additionally, here is a code sample, written in Laravel 10.

Route::domain('{account}.example.com')->group(function () {
    Route::get('user/{id}', function (string $account, string $id) {
        // ...
    });
});

If you feel like my answer has helped you, please mark it so others can find it!

Report
1