HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/app/KommaApp/Shop/ShopRepository.php
<?php
namespace KommaApp\Shop;

class ShopRepository
{

    /**
     * @param $shopId
     * @return mixed
     */
    public function getShop($shopId)
    {
        return \DB::table('shops')
            ->where('id', '=', $shopId)
            ->select('*')
            ->first();
    }

    /*
     * @returns Object
     */
    public function getShopWithDomainByDomain(Domain $domain)
    {
        return \DB::table('shops')
            ->join('domains', 'shops.id', '=', 'domains.shop_id')
            ->where('domains.domain', '=', $domain->get())
            ->first();
    }

    /*
     * @returns Array
     */
    public function getShopsWithLanguageById($shopId = null)
    {
        $shopLanguages = \DB::table('shops')
            ->join('shop_language', 'shops.id', '=', 'shop_language.shop_id')
            ->join('languages', 'languages.id', '=', 'shop_language.language_id')
            ->select('shops.id', 'shops.default_language_id', 'languages.id as language_id', 'languages.iso_2 as language_slug');
        if ($shopId) {
            $shopLanguages = $shopLanguages->where('shop_language.shop_id', '=', $shopId);
        }
        return $shopLanguages->get();
    }

    public function getShopCountry($shopId)
    {
        return \DB::table('shops')
            ->join('countries', 'shops.country_id', '=', 'countries.id')
            ->select('countries.name', 'countries.iso_2')
            ->where('shops.id', '=', $shopId)
            ->first();
    }
}