komicho/laravel-switch-domain

There is no license information available for the latest version (dev-master) of this package.

Switch between all domains of your project on development mode

dev-master 2019-03-15 13:20 UTC

This package is not auto-updated.

Last update: 2024-11-17 17:12:42 UTC


README

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.