Skip to content

Switch between all domains of your project on development mode

Notifications You must be signed in to change notification settings

komtcho/laravel-switch-domain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

komicho\laravel-switch-domain

Switch between all domains of your project on development mode

Install via composer

$ composer require komicho/laravel-switch-domain dev-master

set_domain method

set_domain('<domain.dev>');

add KOMICHO_SWITCH_DOMAIN_TO to .env file

KOMICHO_SWITCH_DOMAIN_TO=<domain.dev>

If the value is empty, the domains will work in their default form

How to use

use set_domain method on domain method .. such as the following example

...
->domain(set_domain('<domain.dev>'))
...

Full example

Go to file app/Providers/RouteServiceProvider.php.

web routes

protected function mapWebRoutes()
{
    Route::middleware('web')
            ->namespace($this->namespace)
            ->domain(set_domain('domain.dev'))
            ->group(base_path('routes/web.php'));
}

app routes

protected function mapAppRoutes()
{
    Route::middleware('web')
            ->namespace($this->namespace)
            ->domain(set_domain('app.domain.dev')))
            ->group(base_path('routes/app.php'));
}

According to rules MPL :)

THX.

About

Switch between all domains of your project on development mode

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages