Ahmed Sobh
Ahmed Sobh

Reputation: 11

how to connect two projects Laravel 4.2 and laravel 5.5?

i have a laravel 4.2 project that i want to connect it to laravel 5.5 project

Q1) how to login in the first and and authenticated to the second to so i don't have to login to the second

Q2)how to connect them to the same DB

Q3)let's say i'm in page X in laravel 4.2 and i want to direct it to Y in laravel 5.5 where i should write the route in laravel 4.2 or in 5.5 ?

at the end both of the projects are going to be on the same server and have the same domain if that is going to be helpful

Upvotes: 0

Views: 235

Answers (2)

just_chris
just_chris

Reputation: 154

This is easy to do, just put both applications on the same server and link them using the same credentials in the .ENV file, don't forget you will also need to create Models in both apps so that both apps can use the tables.

As for the routes, you would need to add the routes & functions that can be called in each individual app.

So if the user clicks the URL for /link-to-4.2 you should have a route in 4.2:

Route::get('/link-to-4.2', 'index@controller');

and then in your 5.5 you should have a route for any URLs that direct to anything there. i.e: /link-to-5.5

    Route::get('/link-to-5.5', 'index@controller');

this all being said, what is the justification for using 2 apps? I think there could be a number of security issues that might cause headaches, this will also likely be a real nightmare to manage moving forward.

I would strongely suggest that you just upgrade the 4.2 app to be 5.5.

Upvotes: 1

Kenneth Sunday
Kenneth Sunday

Reputation: 895

Q1) how to login in the first and and authenticated to the second to so i don't have to login to the second

if the 2 webapp are in the same domain, it should not be an issue especially if they use the same database.

Q2)how to connect them to the same DB

just use the same credentials and save it on each env file.

Q3)let's say i'm in page X in laravel 4.2 and i want to direct it to Y in laravel 5.5 where i should write the route in laravel 4.2 or in 5.5 ?

you can use the function route instead use the manual routing like to('somepage-on-theother-laravel') this is a tedious work. So i want to ask if why are you using the 2 webapp in the same domain instead of just using 1 webapp framework. Im thinking that this laravel 4.2 is the existing one and you're create a new one and you want to use the laravel 5.5 right?

Upvotes: 1

Related Questions