1 year ago

Pass variable to AppServiceProvider

Posted 1 year ago by Stank0V01

Hello, i have problem with passing variable to AppServiceProvider.

So here is what i want:

First my routes:


Route::group(['domain' => env('PLAIN_URL')], function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');


// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware'=>'ShopExist'], function () {
    Route::get('/','Shop\[email protected]');


So when someone call {slug} i want slug to my service provider. Please help! Thanks..


I try with request()->get() and many other ways.. But service provider is loaded before request procceed

Please sign in or create an account to participate in this conversation.