dimanche 25 mars 2018

How to change base url in Laravel

Is there anyway to change base url in laravel from controller?

I have two modules in my website one is normal browsing and another is subscription browsing. What i want is , when a user comes to my website first, they get to choose what they want to browse. For example if they want to do normal browsing, then i want to redirect to normal browsing and the url should be www.example.com/normal and i want to make this base url. so what ever link he click there after will be like www.example.com/normal/somelink . Simillarly for subscription it will be like www.example.com/subscription/somelink.

If it is possible how can check in the route that he is in subscription browsing/ normal browsing ?

As of now i am adding prefix in the route . But sometime some url such as login,user/profile etc are becoming exception.

So how can i do so, if it possible. Any advice. ty.

My route as of now

/**
 * NORMAL BROWSING
 */
Route::group(['middleware' => ['web', 'activity'],'namespace' => 'Frontend'], function () {
    Route::prefix('normal')->group(function () {
      .......
     .......
    });
});

/**
 * SUBSCRIPTION BROWSING
 */
Route::group(['middleware' => ['web', 'activity'],'namespace' => 'Frontend'],function(){
    Route::prefix('subscription')->group(function () {  
       ........
      ........
    });

});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire