My aim is to roll out a big re-theming / re-skinning (including new URL routing) for a Laravel v5 project without touching the existing business logic (as much as possible that is).
This is my current approach:
-
I placed a
APP_SKIN=v2
entry in my.env
file -
My
app\Http\routes.php
file has been changed as follows:if (env('APP_SKIN') === "v2") { # Point to the v2 controllers Route::get('/', 'v2\GeneralController@home' ); ... all other v2 controllers here ... } else { # Point to the original controllers Route::get('/', 'GeneralController@home' ); ... all other controllers }
-
All v2 controllers have been placed in
app/Http/Controllers/v2
and namespaced accordingly - All v2 blade templates have been placed in
resources/views/v2
- the rest of the business logic remains exactly the same and shared between the "skins".
My question: Is there a "better" way to achieve the above?. Please note that the idea here is to affect as few files as possible when doing the migration, as well as ensure that the admin can simply change an environment variable and "roll back" to the previous skin if there are problems.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire