in Education by
I have a scenario that I want to implement in Laravel. I have already implemented this kind of approach in custom PHP. But this time, I want to shift all websites to a framework (Laravel). I have multiple domains for different regions implemented (Localization), each domain has its own database and all database tables structure are same only the data is different. Now I want to use single Laravel code instance with the ability to connect multiple databases with multiple domains and each domain has its own theme files. Let suppose: I have some domains 1. abc.com and it has database with name of db_abc with theme/template ABC 2. xyz.com and it has database with name of db_xyz with theme/template XYZ When abc.com domain is hit/accessed, I want to connect with DB db_abc and load data in ABC theme/template. Similar when xyz.com is hit/accessed the database connection should be made with db_xyz and data should be loaded into theme/template XYZ files. Please help me in this regard. Thank you. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
First of all, you need to point all domains to a single project. After that you can catch domains with route group: Route::group(['domain' => 'abc.com'], function() { Route::get('/', 'SomeController@someAction'); }); To use multiple databases you can use connection(): $users = DB::connection('foo')->select(...); If these are similar websites with similar structure, I'd recomment to keep data in single DB (and maybe even in same tables). If you want to use same routes for all sites, you could keep DB and views configuration in config file and check for current domain in middleware: if (strpos(request()->server('HTTP_HOST'), 'abc.com')) { session(['site' => 'abc']); } And get data from config with: $currentDb = config('sites.db')[session('site')]; $currentViewsDir = config('sites.views')[session('site')];

Related questions

0 votes
    I have a scenario that I want to implement in Laravel. I have already implemented this kind of approach ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    I have a scenario that I want to implement in Laravel. I have already implemented this kind of approach ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I currently working on a laravel 5.4 project where I'm trying to find values in my database that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I try to create database from entity framework code first follow with this tutorial http://www.asp.net/mvc ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    Does anyone know how to add another folder to the asset pipeline in Rails 3.1? I'd like to serve app/assets/ ... an asset path, in your application.rb file: config.assets.paths...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    Actually I'm developing a live streaming app for WP7 and I'm facing a problem. I'm trying to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I was working on a new project which has the requirement to use 7 databases, arguing that performance, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I understand nearly nothing to the functioning of EC2. I created an Amazon Web Service (AWS) account. Then I ... user's guide. Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    How to configure inclusions & exclusions in Artifacts Archival?...
asked Sep 14, 2021 in Technology by JackTerrance
0 votes
    I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP ( ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
0 votes
    I have inherited a corporate server & application that consists of several python scripts, html files, and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    Phishers often develop ______________ websites for tricking users & filling their personal data. (a) legitimate ... Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    Which of the following is used to extract data from HTML code of websites? (a) Webscraping (b) ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    I was wondering when it would be a good idea to have a single database vs one database with multiple ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
...