marklj / eloquent-uuid
A package designed to get your eloquent models up and running with UUIDs quickly.
dev-master
2016-07-31 20:46 UTC
Requires
- beberlei/assert: ^2.6
- illuminate/database: 5.2.*
- ramsey/uuid: ^3.4
Requires (Dev)
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2025-02-01 21:36:18 UTC
README
This project is experimental and should not be used on real-life applications.
This is a very simple project that will get you up and running with UUID's within your eloquent models.
Usage
<?php // Object creation $foo = FooModel::create(); print $foo->uuid; // outputs: feb9035d-e9e2-4913-b6d5-695d0d67f882 // Object retrieval $result = FooModel::find('feb9035d-e9e2-4913-b6d5-695d0d67f882'); print $foo->uuid; // outputs: feb9035d-e9e2-4913-b6d5-695d0d67f882
Database Setup
In your database migration for your model, you should have the UUID field set up like the following:
<?php public function up() { Schema::create('foo_table', function (Blueprint $table) { $table->binary('uuid', 16); // ... }); }