LogoLogo
CtrlK
v1.8.0
v1.8.0
  • 🌸What is Petal Pro?
  • 💡Changelog
  • ⏫Upgrade guide
  • Guides
    • 🚀Creating a web app from start to finish
    • 💳Adding a subscription
    • 🔢Creating Your Own API
  • 👩‍🍳Recipes
    • 🍒How to apply a recipe with git cherry pick
    • #️⃣UUIDs
    • ✍️First/Last name
    • 📦NPM packages
    • 🗺️Google Maps
    • Password Hashing for Windows
  • Fundamentals
    • 💿Installation
    • 📂Folder structure
    • 🗃️Included Pages
    • 😀Users & Authentication
    • 🏢Organizations & Multitenancy
    • 💳Stripe billing
    • 🧊Components
    • ⬛Dark mode
    • 🎨Branding
    • 🌱Seeding
    • 📄Layouts & Menus
    • 🖼️Image uploads
    • 👥Impersonation
    • 🛠️Background Tasks and Jobs
    • 🔧Util & Helpers
    • 📧Emails
    • 🪝Javascript Hooks
    • 📚Extra Hex Libraries
    • 🏗️Generators
    • 🗣️Translations
    • 🖐️Contributing
    • 🛫Deployment
    • 🛡️Testing
    • 🔢REST API
Powered by GitBook
On this page

Was this helpful?

  1. Fundamentals

🔧Util & Helpers

We have two files to put helper functions:

  • Util (/lib/petal_pro/util/util.ex) - utility functions used anywhere, eg. random_string()

  • PetalProWeb.Helpers (lib/petal_pro_web/helpers.ex)- utilities functions imported into views (templates and live views), eg. main_menu_items(), is_admin?

If you want to add new helpers, ask "is this only going to be used in templates and live views?". If yes then put it in helpers.ex. If "no", put it in util.ex.

PreviousBackground Tasks and JobsNextEmails

Was this helpful?