You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
1.1 KiB

<?php
namespace App\Repositories;
use SuperGear\Directus\Repositories\RepositoryAbstract;
/**
* request page items from directus
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitlab.tentakelfabrik.de/super-gear/directus GitHub Repository
*/
class PageRepository extends RepositoryAbstract
{
/** name of the collection */
protected $name = 'page';
/**
* find single page with a slug,
* page must be published
*
* @param string $slug
* @return array
*/
public function findOneBySlug($slug)
{
return $this->itemCollection->findOne($this->name, [
'filter[slug][eq]' => $slug,
'filter[status][eq]' => 'published'
]);
}
/**
* find single page with a slug,
* page must be published
*
* @param string $slug
* @return array
*/
public function findByView($view)
{
return $this->itemCollection->find($this->name, [
'filter[view][eq]' => $view,
'filter[status][eq]' => 'published'
]);
}
}