File: D:/HostingSpaces/SBogers10/somerenslust.komma.pro/app/KommaApp/Akkoords/Kms/AkkoordService.php
<?php
namespace App\KommaApp\Akkoords\Kms;
use App\KommaApp\Akkoords\Models\Akkoord;
use App\KommaApp\Kms\Core\Sections\SectionService;
use App\KommaApp\Kms\SidebarListItem;
class AkkoordService extends SectionService
{
protected $sortable = false;
function __construct()
{
$this->forModelName = Akkoord::class;
parent::__construct();
}
/**
* Returns all models for the sidebar menu in the backend
*
* @return array
*/
public function getModelsForSideBar(): array
{
$products = $this->forModelName::orderBy('date', 'DESC')->get();
$sidebarList = [];
foreach ($products as $product) {
$sidebarListItem = new SidebarListItem();
$this->setThumbnail($product);
$this->generateThumbnail($product);
//Set the values for the sidebar
$sidebarListItem->setId($product->id);
$sidebarListItem->setStatus(true);
$sidebarListItem->setName($product->title);
$sidebarListItem->setThumbnail($product->thumbnail);
$sidebarList[] = $sidebarListItem;
}
return $sidebarList;
}
}