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.

58 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. # Super Gear Directus
  2. Project to using a Directus Instance as CMS. Structure is inspired by Laravel, using [FlightPHP](https://github.com/mikecao/flight)
  3. for handle Request.
  4. ## Installation
  5. Download last Release, a Composer Installer will be Available in a Future Release.
  6. ## Snapshot
  7. There is a Snapshot for a Basic Setup for the Directus Instance.
  8. ## Quickstart
  9. Create a **.env** from **.env.example** adding token and url for Directus Instance.
  10. ```
  11. DIRECTUS_API_URL=
  12. DIRECTUS_API_TOKEN=
  13. ```
  14. ## Repositories
  15. For getting Data use **App\\Respositories\\RepositoryAbstract** to create Repository-Classes.
  16. This is the default class to handle
  17. ```PHP
  18. class PageRepository extends RepositoryAbstract
  19. {
  20. /** endpoint */
  21. protected $endpoint = 'pages';
  22. /**
  23. * find single page with a slug,
  24. * page must be published
  25. *
  26. * @param string $slug
  27. * @return array
  28. */
  29. public function findOneBySlug($slug)
  30. {
  31. if (!$slug) {
  32. $slug = [ '_null' => 'true' ];
  33. }
  34. return $this->queryBuilder
  35. ->fields(['title', 'slug', 'content', 'view', 'meta', 'media_teaser.*', 'media_hero.*'])
  36. ->aliases('view', 'template')
  37. ->filter([
  38. 'status' => 'published',
  39. 'slug' => $slug
  40. ])
  41. ->findOne();
  42. }
  43. }
  44. ```