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/sportivo.komma.pro/app/Komma/Page/PageRepository.php
<?php


namespace Komma\Page;
use Illuminate\Support\Facades\DB;

class PageRepository {

    /**
     * Load default page content out of Global.php
     *
     * @param $key
     * @return array
     */
    public function getContent($key)
    {
        return \Lang::get('global.' . $key);
    }

    /**
     * Load the defined button out Buttons.php
     *
     * @param $key
     * @return array
     */
    public function getButton($key)
    {
        return \Lang::get('buttons.' . $key);
    }

    /**
     * Get all customer quotes out of Quotes.php
     *
     * @return array
     */
    public function getQuote()
    {
        return \Lang::get('quotes');
    }

    public function getDocument($document){
        return DB::table('documents')
            ->join('document_translations', 'document_translations.document_id', '=', 'documents.id')
            ->leftJoin('files', function($join)
            {
                $join->on('files.fileable_id', '=', 'documents.id')
                    ->where('files.fileable_type', '=', 'Komma\Kms\Documents\Models\Document');
            })
            ->where('document_translations.name', '=', $document)
            ->select('files.path')
            ->first();
    }


    /**
     * Get all Colleagues out of the DB
     *
     * @return array
     */
    public function getColleagues(){
        return DB::table('colleagues')
            ->join('colleague_translations', 'colleague_translations.colleague_id', '=', 'colleagues.id')
            ->leftJoin('images', function($join)
            {
                $join->on('images.imageble_id', '=', 'colleagues.id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\Colleagues\Models\Colleague');
            })
            ->orderBy('colleagues.lft')
            ->select('colleague_translations.colleague_id', 'colleague_translations.name', 'colleague_translations.specialty', 'colleague_translations.description', 'images.large_image_url')
            ->get();
    }

    /**
     * Get all Facilities out of the DB
     *
     * @return array
     */
    public function getFacilities(){
        return DB::table('facilities')
            ->join('facility_translations', 'facility_translations.facility_id', '=', 'facilities.id')
            ->leftJoin('images', function($join)
            {
                $join->on('images.imageble_id', '=', 'facilities.id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\Facilities\Models\Facility');
            })
            ->orderBy('facilities.lft')
            ->select('facility_translations.name', 'facility_translations.description','facility_translations.intro','facility_translations.direct_button', 'images.large_image_url')
            ->get();
    }

    /**
     * Get all Partners out of the DB
     *
     * @return array
     */
    public function getPartners(){
        return DB::table('partners')
            ->join('partner_translations', 'partner_translations.partner_id', '=', 'partners.id')
            ->leftJoin('images', function($join)
            {
                $join->on('images.imageble_id', '=', 'partners.id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\Partners\Models\Partner');
            })
            ->orderBy('partners.lft')
            ->select('partner_translations.partner_id','partner_translations.name', 'partner_translations.full_name', 'partner_translations.description', 'partner_translations.intro', 'images.large_image_url')
            ->get();
    }

    /**
     * Get the Action for on the homepage
     *
     * @return array
     */
    public function getAction(){
        return DB::table('information')
            ->join('information_translations', 'information_translations.information_id', '=', 'information.id')
            ->leftJoin('images', function($join)
            {
                $join->on('images.imageble_id', '=', 'information.id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\Information\Models\Information');
            })
            ->select('information_translations.home_title', 'information_translations.home_text', 'information_translations.enabled', 'images.large_image_url')
            ->first();
    }

    /**
     * Get the Action page out of the DB
     *
     * @return array
     */
    public function getActionPage(){
        return DB::table('information')
            ->join('information_translations', 'information_translations.information_id', '=', 'information.id')
            ->leftJoin('images', function($join)
            {
                $join->on('images.imageble_id', '=', 'information.id')
                    ->where('images.imageble_type', '=', 'Komma\Kms\Information\Models\Information');
            })
            ->select('information_translations.name', 'information_translations.description', 'images.large_image_url')
            ->first();
    }

    /**
     * Get the Nutrition page out of the DB
     *
     * @return array
     */
    public function getNutritionPage(){
        return DB::table('pages')
            ->join('page_translations', 'page_translations.page_id', '=', 'pages.id')
            ->select('page_translations.page_title as name','page_translations.description', 'page_translations.sub_text')
            ->where('page_translations.name', '=', 'Voedingsadvies')
            ->first();
    }

    /**
     * Get the Personal Training page out of the DB
     *
     * @return array
     */
    public function getPersonalTraining(){
        return DB::table('pages')
            ->join('page_translations', 'page_translations.page_id', '=', 'pages.id')
            ->select('page_translations.page_title as name','page_translations.description', 'page_translations.sub_text')
            ->where('page_translations.name', '=', 'Personal training')
            ->first();
    }

    /**
     * Get All group lessons and the Route (for Sitemap)
     *
     * @return array
     */
    public function getGroupLessonsRoutes(){
        return DB::table('group_lesson_translations')
            ->leftJoin('routes', 'group_lesson_translations.id', '=', 'routes.routable_id')
            ->orderBy('routes.routable_id')
            ->select('group_lesson_translations.name','routes.route')
            ->where('routes.routable_type', '=', 'Komma\Kms\GroupLessons\Models\GroupLessonTranslation')
            ->get();
    }
}