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/cafe-de-bout.komma.pro/app/Servicepoints/ServicePointComposer.php
<?php


namespace App\Servicepoints;


use App\Buttons\Models\Button;
use App\Servicepoints\Models\Servicepoint;
use Illuminate\Contracts\View\View;

class ServicePointComposer
{

    public static $servicepoint;
    public static $button;


    /**
     * Bind data to the view.
     *
     * @param View $view
     * @return View
     */
    public function compose(View $view)
    {

        if(!isset(self::$servicepoint)) {
            self::$servicepoint = Servicepoint::where('id', '=', config('site.global_CTA_servicepoint_id'))->with('translations', 'documents')->first();
        }

        if(!isset(self::$button)) {
            self::$button = Button::where('id', '=', config('site.global_CTA_button_id'))->with('translations')->first();
        }
        $CTA_heading = config('site.global_CTA_heading');

        return $view->with([
            'heading' => $CTA_heading,
            'servicepoint' => self::$servicepoint,
            'button' => self::$button,
        ]);
    }

}