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/ContentSliderComposer.php
<?php


namespace App\Komma\Composers;


use Illuminate\View\View;

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

        $buttonData = [];

        $tabs = $viewData['component']->tabs;

        foreach($tabs as $tab) {

            //Check if button exists
            if(
                $tab->buttons &&
                count($tab->buttons) > 0 &&
                $tab->buttons[0]->translation
            ) {
                $button = $tab->buttons[0];

                //Check if button has label and url. If so, add to buttonData.
                if($button->translation->label && $button->translation->url) {
                    $hash = spl_object_hash($tab);
                    $buttonData[$hash] = [
                        'buttonText' => $button->translation->label ?: null,
                        'buttonLink' => $button->translation->url ?: null,
                    ];
                }
            }
        }

        $view->with('buttonData', $buttonData);
    }
}