2017 © Pedro Peláez
 

library laravel-multisite

Multisite setup for Laravel

image

appstract/laravel-multisite

Multisite setup for Laravel

  • Monday, January 22, 2018
  • by gizburdt
  • Repository
  • 15 Watchers
  • 166 Stars
  • 533 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 0 Open issues
  • 17 Versions
  • 7 % Grown

The README.md

Laravel Multisite

Latest Version on Packagist Total Downloads Software License Build Status, (*1)

With this package it is possible to build multiple sites/(sub)domains on one codebase., (*2)

Installation

You can install the package via composer:, (*3)

composer require appstract/laravel-multisite

Config (hosts, homestead)

You need to add the sites to your /etc/hosts file and Homestead.yaml. For example, mywebsite.dev and blog.mywebsite.dev. In the Homestead.yaml, you need to map the sites to the same folder., (*4)

Publish

By running php artisan vendor:publish --provider="Appstract\Multisite\MultisiteServiceProvider" in your project all files for multisite will be published. The files that will be published are: a migration, a seeder and a config file., (*5)

Seeder

The seeder will be published but needs to be run when running php artisan db:seed, so you need the add $this->call(SitesTableSeeder::class); to your DatabaseSeeder.php file. After migrating and seeding the sites are now present in the database., (*6)

Usage

This is the main part, within your routes/web.php you can set routes for your sites within route groups, like this:, (*7)

Route::group([
    'domain' => 'blog.'.config('multisite.host'),
    'as' => 'blog.',
    'middleware' => 'site:blog'
], function () {
    Route::get('/', 'BlogController@homepage')->name('homepage');
});

The magic happens with the site middleware site:blog. This will tell your app that the routes within the group are belonging to the blog. It will provide a variable called $currentSite in all your views. There is also a config available, which you can access with Config::get('multisite.site')., (*8)

Testing

bash $ composer test, (*9)

Contributing

Contributions are welcome, thanks to y'all :), (*10)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon., (*11)

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

22/01 2018

dev-master

9999999-dev https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

22/01 2018

1.0.0

1.0.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

06/10 2017

0.5.3

0.5.3.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

06/10 2017

0.5.2

0.5.2.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

03/07 2017

0.5.1

0.5.1.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

03/07 2017

0.5.0

0.5.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

19/06 2017

0.4.2

0.4.2.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

04/05 2017

0.4.1

0.4.1.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

04/05 2017

0.4.0

0.4.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

02/05 2017

0.3.1

0.3.1.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

02/05 2017

0.3.0

0.3.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

11/04 2017

0.2.1

0.2.1.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

07/04 2017

0.2.0

0.2.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

13/03 2017

0.1.3

0.1.3.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

10/03 2017

0.1.2

0.1.2.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

06/03 2017

0.1.1

0.1.1.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite

01/03 2017

0.1.0

0.1.0.0 https://github.com/appstract/laravel-multisite

Multisite setup for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-multisite