<?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'
							 | 
						|
								        ]);
							 | 
						|
								    }
							 | 
						|
								}
							 |