https://github.com/komtcho/laravel-switch-domain
Switch between all domains of your project on development mode
https://github.com/komtcho/laravel-switch-domain
domains komicho laravel mpl packages php switch
Last synced: 2 months ago
JSON representation
Switch between all domains of your project on development mode
- Host: GitHub
- URL: https://github.com/komtcho/laravel-switch-domain
- Owner: komtcho
- Created: 2019-03-15T12:30:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-15T13:20:26.000Z (over 7 years ago)
- Last Synced: 2025-01-09T12:40:06.155Z (over 1 year ago)
- Topics: domains, komicho, laravel, mpl, packages, php, switch
- Language: PHP
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# komicho\laravel-switch-domain
Switch between all domains of your project on development mode
## Install via composer
```bash
$ composer require komicho/laravel-switch-domain dev-master
```
---
## `set_domain` method
```php
set_domain('');
```
## add `KOMICHO_SWITCH_DOMAIN_TO` to .env file
```env
KOMICHO_SWITCH_DOMAIN_TO=
```
> 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
```php
...
->domain(set_domain(''))
...
```
## Full example
Go to file `app/Providers/RouteServiceProvider.php`.
### web routes
```php
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->domain(set_domain('domain.dev'))
->group(base_path('routes/web.php'));
}
```
### app routes
```php
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](https://medium.com/@komicho/micro-package-logic-mpl-10f22ccc50c1) :)
THX.