Project: Laravel 12 Helper Functions

name:
Laravel 12 Helper Functions
summary:
This contains a lot of helpful Laravel 12 helper functions that are used by the craig-zearfoss/laravel-multi-guard and craigzearfoss/portfolio repositories.
year:
2025
language:
Laravel
language version:
12.29
description:
This includes the following functions:

  • canCreate / canDelete / canRead / canUpdate : Returns true if the account can create, delete, read, or update a resource.

  • getAdmin / getAdminId : Returns the Admin object or id of the logged-in admin.

  • getUser / getUserId : Returns the User object or id of the logged-in admin.

  • dateRangeDetails : Returns an array of details about a date.

  • formatCompensation : Returns a formatted compensation.

  • formatLocation : Returns a formatted address.

  • getFileSlug : Generates a slug for a file from a text string.

  • coverLetterDir / imageDir / resumeDir : Returns the directory where the cover letters, images, or resumes are stored.

  • generateEncodedFilename : Generates a unique base64 encoded name for the file.

  • imageUrl : Returns the url for an image.

  • isAdmin / isUser / isRootAdmin : Returns true if the current logged in account is for an admin, a user, or an admin with root privileges.

  • isDemo : Returns true if the site is in demo mode.

  • referer: Returns the url of the refering page or the specified fallback route if there was no referer.

  • refererRouteName : Returns the route name of the refering page or null if there was no refering page.

  • reservedKeywords : Returns a list of reserved keywords.

  • resourceRoute: Returns the route for a resource.

  • themedTemplate : Returns the path to a themed template file if it exists, otherwise it returns the default template file.

  • uniqueSlug: Generates a unique slug for a text string.