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/werkenbij.komma.pro/app/Komma/Composers/ServicePointComposer.php
<?php


namespace App\Komma\Composers;


use Illuminate\View\View;

class ServicePointComposer
{
    /**
     * @param View $view
     */
    public function compose(View $view)
    {
        $viewData = $view->getData();

        $servicepointFirstName = null;
        $servicepointLastName = null;
        $servicepointFunction = null;
        $servicepointEmail = null;
        $servicepointTelephoneLabel = null;
        $servicepointTelephoneUrl = null;
        $servicepointImage = null;


        if(isset($viewData['servicepoint'])) {
            // If the translation can't be found, fallback to first translation that does exist
            if ($viewData['servicepoint']->translation == null){
                $viewData['servicepoint']->translation = $viewData['servicepoint']->translations->first();
            }

            if (
                $viewData['servicepoint']->documents &&
                count($viewData['servicepoint']->documents) > 0 &&
                $viewData['servicepoint']->documents[0]->small_image_url
            ) {
                $servicepointImage = $viewData['servicepoint']->documents[0]->small_image_url;
            } else {
                $servicepointImage = '/img/placeholder-person.svg';
            }

            if ($viewData['servicepoint']->translation) {
                $servicepointFirstName = $viewData['servicepoint']->translation->first_name;
                $servicepointLastName = $viewData['servicepoint']->translation->last_name;
                $servicepointFunction = $viewData['servicepoint']->translation->function;
                $servicepointEmail = $viewData['servicepoint']->translation->email;
                $servicepointTelephoneLabel = $viewData['servicepoint']->translation->telephone_label;
                $servicepointTelephoneUrl = $viewData['servicepoint']->translation->telephone_url;
            } else {
                if(isset($viewData['phoneDisplay'])) $servicepointTelephoneLabel = $viewData['phoneDisplay'];
                if(isset($viewData['phoneCall'])) $servicepointTelephoneLabel = $viewData['phoneCall'];
            }
        }

        $view->with('servicepointImage', $servicepointImage);
        $view->with('servicepointFirstName', $servicepointFirstName);
        $view->with('servicepointLastName', $servicepointLastName);
        $view->with('servicepointFunction', $servicepointFunction);
        $view->with('servicepointEmail', $servicepointEmail);
        $view->with('servicepointTelephoneLabel', $servicepointTelephoneLabel);
        $view->with('servicepointTelephoneUrl', $servicepointTelephoneUrl);
    }
}