Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
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.

47 lines
1018 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <?php
  2. namespace App\Repositories;
  3. use App\Repositories\RepositoryAbstract;
  4. /**
  5. * request pages items from directus
  6. *
  7. * @author Björn Hase, Tentakelfabrik
  8. * @license http://opensource.org/licenses/MIT The MIT License
  9. * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/super-gear-directus
  10. *
  11. */
  12. class SnippetRepository extends RepositoryAbstract
  13. {
  14. /** endpoint */
  15. protected $endpoint = 'snippets';
  16. /**
  17. * find single page with a slug,
  18. * page must be published
  19. *
  20. * @param string $slug
  21. * @return array
  22. */
  23. public function findByName($name)
  24. {
  25. $results = $this->queryBuilder
  26. ->fields([
  27. 'title',
  28. 'content',
  29. 'name',
  30. 'view',
  31. 'file.id',
  32. 'file.description'
  33. ])
  34. ->aliases('template', 'view')
  35. ->filter([
  36. 'name' => $name
  37. ])
  38. ->find();
  39. return $results;
  40. }
  41. }