File: D:/HostingSpaces/SBogers10/finsteps.komma.pro/app/Composers/CalloutBarComposer.php
<?php
namespace App\Composers;
use App\WebsiteConfig\Model\WebsiteConfig;
use App\Buttons\Models\Button;
use Illuminate\View\View;
class CalloutBarComposer
{
/**
* @param View $view
*/
public function compose(View $view)
{
$calloutBarHeading = WebsiteConfig::where('code_name', '=', 'global_CTA_heading')->first()->value ?? null;
$calloutBarPhoneDisplay = WebsiteConfig::where('code_name', '=', 'company_phone_display')->first()->value ?? null;
$calloutBarPhoneCall = WebsiteConfig::where('code_name', '=', 'company_phone_call')->first()->value ?? null;
$calloutBarButtonId = WebsiteConfig::where('code_name', '=', 'global_CTA_button_id')->first()->value ?? null;
$calloutBarButton = Button::where('id', $calloutBarButtonId)->with('translations')->first() ?? null;
$view->with([
'calloutBarHeading' => $calloutBarHeading,
'calloutBarPhoneDisplay' => $calloutBarPhoneDisplay,
'calloutBarPhoneCall' => $calloutBarPhoneCall,
'calloutBarButtonText' => $calloutBarButton->translation->label ?? null,
'calloutBarButtonLink' => $calloutBarButton->translation->url ?? null,
]);
}
}