i want to make multi-store system with Laravel. There will be one website but different stores. I want to switch themes and contents according to domain name.
For example i have 2 sites or more :
127.0.0.1 www.firststore.com
127.0.0.1 www.secondstore.com
System should check domain name and according to domain name it should fetch its own config from db. With this config it should switch theme and content of site.
How can i develop this system ?
Many thanks for any opinion!
The best way should be a middleware and for example the view()->share() method to bring your css into the view.
In the middleware you can do something like Request::getHost() and than retrieve a Store model by this host from your database after this you can set variables, for the following process. And you can add scopes to your models that are store related like scopeHost($query, $host) to select just the models that are related to your current Store.
http://laravel.com/docs/5.1/middleware
http://laravel.com/docs/5.1/views#sharing-data-with-all-views
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.