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/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;
    }
}