Skip to content

Model Class

primaryKeys()

primaryKeys() — returns string

Available in: model Category: Miscellaneous Functions

Alias for primaryKey(). Use this for better readability when you’re accessing multiple primary keys.

NameTypeRequiredDefaultDescription
positionnumericno0If you are accessing a composite primary key, pass the position of a single key to fetch.
// Get a list of the names of the primary keys in the table mapped to the `employee` model (which is the `employees` table by default)
keyNames = model("employee").primaryKeys();