Download the PHP package jenbuzz/laravel-uuid without Composer
On this page you can find all versions of the php package jenbuzz/laravel-uuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jenbuzz/laravel-uuid
More information about jenbuzz/laravel-uuid
Files in jenbuzz/laravel-uuid
Package laravel-uuid
Short Description Adds a uuid to a model using ramsey/uuid
License MIT
Informations about the package laravel-uuid
Laravel UUID
This package easily adds a uuid generated with ramsey/uuid to an Eloquent model.
Installation
Documentation
To automatically create a uuid for new models all that is needed is to include the uuid trait as in the following example:
There are several options to specify the uuid that should be generated: 'uuidVersion', 'uuidString', 'uuidColumnName', and 'uuidGenerateOnSave'. But first...
Default values are:
- uuidVersion = 4
- uuidString = ''
- uuidColumnName = 'uuid'
- uuidGenerateOnSave = false
The last option, 'uuidGenerateOnSave', will generate a uuid for the element on the next save action if set to true. This could be useful if uuids were introduced later on and existing elements require an uuid.
To change these options they can be specified through class properties in the model as in the following example:
The uuid trait also adds a 'find'-function to the model which makes it is easy to find an element by uuid. This can be done as in the following code snippet:
License
This package is open-sourced software licensed under the MIT license
All versions of laravel-uuid with dependencies
ramsey/uuid Version ^4.0.1
illuminate/database Version ^7.6
illuminate/support Version ^7.6