Helpers

EnumHelper

this trait brings useful static methods to enum classes.

Available methods

toArray

Convert values of an enum class to an array.

toArrayKeys

Convert keys of an enum class to an array.

toArrayExcept

Convert values of an enum class to an array except the given values.

toArrayKeysExcept

Convert keys of an enum class to an array except the given keys.

toArrayOnly

Convert given values of an enum class to an array.

toArrayKeysOnly

Convert given keys of an enum class to an array.

all

Create an array using all enum members.

IndexedAll

Create an array using values of all enum members.

tryFromKey

Find a value using the given key, otherwise return the default value.

Functions

Valravn includes several global functions that you can use in your code.

user

Return authenticated user or optional null.

resolveRelatedIdToModel

Resolve the given id to a related model.

resolveMorphableToResource

Resolve given Model to a resource class.

logg

Log the given exception to a specific channel and format.

slugify

Make a english or non-english string to a slug.