File: D:/HostingSpaces/stafa/werkenbijstafa.nl/app/Komma/WebsiteConfig/ServicePointComposer.php
<?php
namespace App\Komma\WebsiteConfig;
use App\Komma\Buttons\Models\Button;
use App\Komma\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,
]);
}
}