File: D:/HostingSpaces/SBogers93/fitale.nl/workbench/komma/kms/src/Komma/Kms/Core/KmsRepository.php
<?php
/**
* Short description for the file.
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Kms\Core;
use Illuminate\Support\Collection;
use Komma\Kms\Images\Models\Image;
abstract class KmsRepository
{
protected $kms;
public $buttons;
function __construct(Kms $kms)
{
$this->kms = $kms;
$this->buttons = [
['value' => 'about', 'content' => 'Meer over ons'],
['value' => 'contact', 'content' => 'Neem contact op']
];
}
/**
* This loads the images for a given model
* Based on the id, and type of a model
* and filtered by the attribute_key
* It collects the images from db
*
* @param $id
* @param $type
* @param null $attributeKey
* @return mixed
*/
protected function getImages($id, $type, $attributeKey = 'images')
{
$imageRecords = Image::where('imageble_type', $type)
->where('imageble_id', $id)
->where('attribute_key', $attributeKey)
->orderBy('sort_order', 'asc')
->get(); $images = $imageRecords->toArray();
return $images;
}
/*
abstract public function newEntity();
abstract public function getEntity($id);
abstract public function getEntities();
abstract public function saveEntity($entity);
abstract public function destroyEntity($id);
*/
}