Decoy

A Laravel model-based CMS
By Bukwild

View on GitHub
Case study

Elements

Copy, images, and files that aren’t managed as part of an item in a list. If content needs to be managed and a model doesn’t make sense, use Elements.

Setup

Begin by customizing the config/decoy/elements.yaml file that will have been published during the Decoy installation. Roughly speaking, there are 3 nested layers of hashes that configure elements:

The syntax has a terse form:

homepage:
  marquee:
    image,image: /img/temp/home-marquee.jpg

And an expanded form:

homepage:
  label: The homepage
  help: This is the site homepage
  sections:
    marquee:
      label: Home marquee
      help: The featured image section on the top of homepage
      fields:
        image:
          type: image
          label: An image
          value: /img/temp/home-marquee.jpg

The two forms can be intermixed. Check out the elements.yaml file for more examples.

Alternatively, you can create a directory at config/decoy/elements and create many different .yaml files within there. They all share the same syntax as the main elements.yaml and get merged into recursively merged into one another.

Usage

Call Decoy::el('key') in your frontend views to return the value for an Element. They key is the . concatented keys for the three heirachies: page.section.field. The value will be massaged in different ways depending on the element type:

Additional notes