src/ShopifyApp/Middleware/AuthShop.php
protected function validateShop(Request $request)
    {
        $shopParam = ShopifyApp::sanitizeShopDomain($request->get('shop'));
        $shop = ShopifyApp::shop($shopParam);
        $session = new ShopSession($shop);

        // Check if shop has a session, also check the shops to ensure a match
        if (
            $shop === null ||
            $shop->trashed() ||
            empty($session->getToken(true)) ||
            ($shopParam && $shopParam !== $shop->shopify_domain) === true
        ) {
            // Either no shop session or shops do not match
            $session->forget();

            // Set the return-to path so we can redirect after successful authentication
            Session::put('return_to', $request->fullUrl());

            return Redirect::route('authenticate', ['shop' => $shopParam]);
        }

        return true;
    }
protected function validateShop(Request $request)
    {
        $shopParam = ShopifyApp::sanitizeShopDomain($request->get('shop'));
        $shop = ShopifyApp::shop($shopParam);
        $session = new ShopSession($shop);

        // Check if shop has a session, also check the shops to ensure a match
        if (
            $shop === null ||
            $shop->trashed() ||
            empty($session->getToken(true)) ||
            ($shopParam && $shopParam !== $shop->shopify_domain) === true
        ) {
            // Either no shop session or shops do not match
            $session->forget();

            // Set the return-to path so we can redirect after successful authentication
            Session::put('return_to', $request->fullUrl());

            return Redirect::route('authenticate', ['shop' => $shopParam]);
        }

        return true;
    }
Checks we have a valid shop.

@param \Illuminate\Http\Request $request

@return bool|\Illuminate\Http\RedirectResponse