File: D:/HostingSpaces/SBogers10/zuiderbos.komma.pro/app/Komma/Faq/Composers/FaqComposer.php
<?php
namespace Komma\Faq\Composers;
use Komma\Faq\Models\Faq;
class FaqComposer
{
/**
* Provide footer with navigation
*
* @param $view
*/
public function compose($view)
{
$faq = Faq::where('lft', '!=', 1)
->with('translation')
->with('schools')
->where('active', 1)
->orderBy('lft')
->get();
$homeFaq = [];
foreach ($faq as $item) {
//Check if school or global isset
if (! isset($item->schools)) {
continue;
}
$global = false;
foreach ($item->schools as $faqSchool) {
if ($faqSchool->id == 6) {
$global = true;
}
}
if ($global) {
$homeFaq[] = $item;
}
}
$view->with(['faq'=> $homeFaq]);
}
}