Pass variable to AppServiceProvider

Posted 7 months ago by Stank0V01

Hello, i have problem with passing variable to AppServiceProvider.

So here is what i want:

First my routes:

<?php

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]');
});

Auth::routes();

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

P.S

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.

Reply to

Use Markdown with GitHub-flavored code blocks.