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.
super-gear-directus/app/Repositories/SnippetRepository.php

48 lines
1018 B

3 years ago
<?php
namespace App\Repositories;
use App\Repositories\RepositoryAbstract;
/**
* request pages items from directus
*
* @author Björn Hase, Tentakelfabrik
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.tentakelfabrik.de/Tentakelfabrik/super-gear-directus
*
*/
class SnippetRepository extends RepositoryAbstract
{
/** endpoint */
protected $endpoint = 'snippets';
/**
* find single page with a slug,
* page must be published
*
* @param string $slug
* @return array
*/
3 years ago
public function findByName($name)
3 years ago
{
$results = $this->queryBuilder
->fields([
'title',
'content',
3 years ago
'name',
3 years ago
'view',
3 years ago
'file.id',
'file.description'
3 years ago
])
->aliases('template', 'view')
->filter([
3 years ago
'name' => $name
3 years ago
])
->find();
return $results;
}
}