From ea3ec0baccda37fbd8778bcb357d01dd9cc96e91 Mon Sep 17 00:00:00 2001 From: Jake Mitchell Date: Sat, 25 Jun 2016 21:12:01 +0000 Subject: [PATCH 1/5] added docblocks, contract, and service provider --- .gitignore | 3 +- .scrutinizer.yml | 4 + .travis.yml | 8 ++ README.md | 134 +++++++++++++++++++++++++++++- composer.json | 12 ++- composer.lock | 145 --------------------------------- contributors.txt | 3 +- phpunit.php | 5 ++ phpunit.xml | 16 ++++ src/Contracts/MetaContract.php | 80 ++++++++++++++++++ src/Meta.php | 121 +++++++++++++++++++++------ src/MetaServiceProvider.php | 40 +++++++++ tests/MetaTest.php | 15 ++++ 13 files changed, 407 insertions(+), 179 deletions(-) create mode 100644 .scrutinizer.yml create mode 100644 .travis.yml delete mode 100644 composer.lock create mode 100644 phpunit.php create mode 100644 phpunit.xml create mode 100644 src/Contracts/MetaContract.php create mode 100644 src/MetaServiceProvider.php create mode 100644 tests/MetaTest.php diff --git a/.gitignore b/.gitignore index a725465..4f4acd3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -vendor/ \ No newline at end of file +vendor/ +composer.lock \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..474553d --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,4 @@ +checks: + php: + code_rating: true + duplication: true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e246774 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php +php: + - 5.5 + - 5.6 + - 7.0 + - hhvm +before_script: travis_retry composer install --no-interaction --prefer-source +script: phpunit \ No newline at end of file diff --git a/README.md b/README.md index 19a54ad..6deda6f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,118 @@ -Laravel Meta-Articles Package +# Laravel Meta-Articles + +[![Build Status][ico-build]][link-travis] +[![Quality Score][ico-scrutinizer]][link-scrutinizer] +[![Latest Unstable Version][ico-unstable]][link-packagist] +[![License][ico-license]][link-license] +[![Total Downloads][ico-downloads]][link-packagist] +[![Latest Stable Version][ico-stable]][link-packagist] + +The Framework for Meta enabled Laravel models. + + +## Install + +Via Composer + +``` bash +$ composer require glmdev/meta +``` + +### Update the Laravel Framework + +Add the following provider to config/app.php + +``` php +'providers' => [ + Glmdev\Meta\MetaServiceProvider::class +] +``` + + +## Usage + +When declaring a new model, extend the Meta model: + +``` php + *Important*: do not extend the Model class, Meta does this for you + +Then, include the 'meta' and 'uuid' columns in your database table: + +In your migration, +``` php +setUuid(); +} +``` + +You now have access to a universal identifier for every model in the entire project. + +You can check if a model has a UUID, and get it if it does: +``` php +$post->hasUuid(); // returns true or false +$post->getUuid(); // returns the UUID if it exists, else null +``` + +The other big feature of the Meta model is saving meta information. +This information is stored in the database in one column: 'meta' + +To save meta information, use the 'write' method. +``` php +$post->write('author', 'Bob Saget'); +``` + +And to retrieve meta information, use the 'read' method. +``` php +$post->read('author'); //returns 'Bob Saget' +``` + + +## Credits + +- [Garrett Mills][link-author] +- [All Contributors][link-contributors] + + +## License and Copyright + Copyright (C) 2016 Garrett Mills This program is free software: you can redistribute it and/or modify @@ -12,4 +126,20 @@ Laravel Meta-Articles Package GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . \ No newline at end of file + along with this program. If not, see . + +Please see [License File][link-license] for more details. + +[ico-stable]: https://poser.pugx.org/glmdev/meta/v/stable +[ico-unstable]: https://poser.pugx.org/glmdev/meta/v/unstable +[ico-downloads]: https://poser.pugx.org/glmdev/meta/downloads +[ico-license]: https://poser.pugx.org/glmdev/meta/license +[ico-scrutinizer]: https://scrutinizer-ci.com/g/glmdev/meta/badges/quality-score.png?b=master +[ico-build]: https://travis-ci.org/glmdev/meta.svg + +[link-travis]: https://travis-ci.org/glmdev/meta +[link-packagist]: https://packagist.org/packages/glmdev/meta +[link-scrutinizer]: https://scrutinizer-ci.com/g/glmdev/meta +[link-license]: ./LICENSE +[link-author]: https://github.com/glmdev +[link-contributors]: ../../contributors \ No newline at end of file diff --git a/composer.json b/composer.json index 1122ddb..7e45d01 100644 --- a/composer.json +++ b/composer.json @@ -9,13 +9,19 @@ } ], "require": { - "ramsey/uuid": "^3.2", + "php": ">=5.6.4", + "illuminate/support": "^5.2", + "illuminate/database": "^5.2", + "ramsey/uuid": "^3.4", "glmdev/foundation": "^0.0.004" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "autoload": { "psr-4": { - "App\\": "../../../app/", - "Glmdev\\Meta\\": "src/" + "Glmdev\\Meta\\": "src/", + "Glmdev\\Meta\\Tests\\": "tests/" } } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index cbb26a3..0000000 --- a/composer.lock +++ /dev/null @@ -1,145 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "f28a14cc53da5df0fb6ab22362338395", - "content-hash": "b07b9654708a316c5adb2dec5078fe8a", - "packages": [ - { - "name": "paragonie/random_compat", - "version": "v2.0.2", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/088c04e2f261c33bed6ca5245491cfca69195ccf", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ], - "time": "2016-04-03 06:00:07" - }, - { - "name": "ramsey/uuid", - "version": "3.3.0", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "f44f53e5ceb7474a83b6e11e6623ff9d6f6da598" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/f44f53e5ceb7474a83b6e11e6623ff9d6f6da598", - "reference": "f44f53e5ceb7474a83b6e11e6623ff9d6f6da598", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "^1.0|^2.0", - "php": ">=5.4" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "apigen/apigen": "^4.1", - "ircmaxell/random-lib": "^1.1", - "jakub-onderka/php-parallel-lint": "^0.9.0", - "mockery/mockery": "^0.9.4", - "moontoast/math": "^1.1", - "phpunit/phpunit": "^4.7|^5.0", - "satooshi/php-coveralls": "^0.6.1", - "squizlabs/php_codesniffer": "^2.3" - }, - "suggest": { - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - }, - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", - "homepage": "https://github.com/ramsey/uuid", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "time": "2016-03-22 18:40:53" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "beta", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/contributors.txt b/contributors.txt index 9dc2d57..22c5c68 100644 --- a/contributors.txt +++ b/contributors.txt @@ -1 +1,2 @@ -Garrett Mills \ No newline at end of file +Garrett Mills +Jake Mitchell \ No newline at end of file diff --git a/phpunit.php b/phpunit.php new file mode 100644 index 0000000..50765d6 --- /dev/null +++ b/phpunit.php @@ -0,0 +1,5 @@ + + + + + ./tests + + + diff --git a/src/Contracts/MetaContract.php b/src/Contracts/MetaContract.php new file mode 100644 index 0000000..47bc3df --- /dev/null +++ b/src/Contracts/MetaContract.php @@ -0,0 +1,80 @@ +meta ); + if ( array_key_exists( $key, $meta ) ){ return $meta[ $key ]; } - else { - return null; - } + + return null; } - - function write( $key, $value ){ + + /** + * Adds the key-value pair into the serialized data set. + * + * @param string|int $key + * @param string|int|float|array|bool|null $value + * + * @return void + */ + public function write( $key, $value ){ $meta = unserialize( $this->meta ); $meta[ $key ] = $value; $meta = serialize( $meta ); @@ -36,41 +65,79 @@ class Meta extends Model implements FoundationModel $this->save(); } - function readRaw(){ + /** + * Get the serialized value of the meta info. + * + * @return string + */ + public function readRaw(){ return $this->meta; } - function writeRaw( $serialized ){ + /** + * Set (override) the entire meta with an unmodified string. + * + * @param string $serialized + * + * @return void + */ + public function writeRaw( $serialized ){ $this->meta = $serialized; $this->save(); } + /** + * Get the universal identifier of the model. + * + * @return \Ramsey\Uuid\Uuid + */ public function getUUID(){ return $this->uuid; } + /** + * Set the universal identifier of the model (can only be set once). + * + * @return void + */ public function setUuid(){ - // check if UUID is set - if( !isset($this->uuid) || is_null($this->uuid) || $this->uuid === "" ){ + if( is_null($this->uuid) || $this->uuid === "" ){ $this->uuid = Uuid::uuid4(); - - return true; - } - else { - return false; } } - public function rawUuid( Uuid $uuid ){ + /** + * Ask if the model has a universal identifier. + * + * @return bool + */ + public function hasUuid(){ + return ( isset($this->uuid) && $this->uuid !== "" ); + } + + /** + * Set the universal identifier via existing UUID. + * + * @param \Ramsey\Uuid\Uuid $uuid + * + * @return void + */ + public function setRawUuid( Uuid $uuid ){ $this->uuid = $uuid; $this->save(); } + /** + * Add the UUID and Meta columns to the table. + * + * @param \Illuminate\Database\Schema\Blueprint + * + * @return void + */ public static function formTable( Blueprint $table ){ $table->uuid('uuid'); $table->text('meta'); } public static function route(){} - } \ No newline at end of file diff --git a/src/MetaServiceProvider.php b/src/MetaServiceProvider.php new file mode 100644 index 0000000..38c0d00 --- /dev/null +++ b/src/MetaServiceProvider.php @@ -0,0 +1,40 @@ +app->bind(Contracts\Meta::class, 'Meta'); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + Contracts\Meta::class, + 'Meta', + ]; + } +} diff --git a/tests/MetaTest.php b/tests/MetaTest.php new file mode 100644 index 0000000..7b88928 --- /dev/null +++ b/tests/MetaTest.php @@ -0,0 +1,15 @@ +assertTrue(true); + } +} From ddea4dd5737ef6353909eb1bb36dff50fcdc9aa4 Mon Sep 17 00:00:00 2001 From: Jake Mitchell Date: Sat, 25 Jun 2016 22:10:21 +0000 Subject: [PATCH 2/5] added tests --- README.md | 8 +++----- composer.json | 3 +-- phpunit.php | 20 ++++++++++++++++++++ src/Meta.php | 2 +- tests/MetaTest.php | 24 +++++++++++++++++++++--- 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6deda6f..f30a5f0 100644 --- a/README.md +++ b/README.md @@ -71,24 +71,22 @@ class CreatePostsTable extends Migration } ``` -Then, when you create a new model, a Post in this case, your function would look something like this: +Then, just create a model like usual: ``` php public function createPost () { $post = Post::create([ // post data ]); - - $post->setUuid(); } ``` -You now have access to a universal identifier for every model in the entire project. +But now, you have access to a universal identifier for every model in the entire project. You can check if a model has a UUID, and get it if it does: ``` php $post->hasUuid(); // returns true or false -$post->getUuid(); // returns the UUID if it exists, else null +$post->getUuid(); // returns the UUID ``` The other big feature of the Meta model is saving meta information. diff --git a/composer.json b/composer.json index 7e45d01..ed81ce7 100644 --- a/composer.json +++ b/composer.json @@ -9,11 +9,10 @@ } ], "require": { - "php": ">=5.6.4", "illuminate/support": "^5.2", "illuminate/database": "^5.2", "ramsey/uuid": "^3.4", - "glmdev/foundation": "^0.0.004" + "glmdev/foundation": "^0.0.10" }, "require-dev": { "phpunit/phpunit": "~4.0" diff --git a/phpunit.php b/phpunit.php index 50765d6..8e6aba8 100644 --- a/phpunit.php +++ b/phpunit.php @@ -1,5 +1,25 @@ addConnection([ + 'driver' => 'sqlite', + 'database' => ':memory:', +]); +$capsule->setAsGlobal(); +$capsule->bootEloquent(); +$capsule->schema()->dropIfExists('metas'); +$capsule->schema()->create('metas', function (Blueprint $table) { + $table->timestamps(); + Meta::formTable($table); +}); \ No newline at end of file diff --git a/src/Meta.php b/src/Meta.php index fb946bf..5f2e06f 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -27,7 +27,7 @@ class Meta extends Model implements FoundationModel, MetaContract */ public static function create( array $args = [] ){ $args['meta'] = (isset($args['meta'])) ? $args['meta'] : serialize([]); - $args['uuid'] = (isset($args['uuid'])) ? $args['uuid'] : ''; + $args['uuid'] = (isset($args['uuid'])) ? $args['uuid'] : Uuid::uuid4(); return parent::create($args); } diff --git a/tests/MetaTest.php b/tests/MetaTest.php index 7b88928..1e67d58 100644 --- a/tests/MetaTest.php +++ b/tests/MetaTest.php @@ -3,13 +3,31 @@ namespace Glmdev\Meta\Tests; use Glmdev\Meta\Meta; +use Ramsey\Uuid\Uuid; class MetaTest extends \PHPUnit_Framework_TestCase { - // TODO: write tests + public function testReadWrite () + { + $model = Meta::create(); + + $model->write('name', 'John'); + $model->write('age', 15); + $model->write('email', 'Johnny@appleseed.com'); + + $this->assertEquals('John', $model->read('name')); + $this->assertEquals(15, $model->read('age')); + $this->assertEquals('Johnny@appleseed.com', $model->read('email')); + } - public function testItReturnsTrue () + public function testUuid () { - $this->assertTrue(true); + $model = Meta::create(); + $uuid = Uuid::uuid4(); + + $this->assertTrue($model->hasUuid()); + + $model->setRawUuid($uuid); + $this->assertEquals($uuid, $model->getUuid()); } } From 70cd8328768672e8eaf9e882503fcf286b0ac944 Mon Sep 17 00:00:00 2001 From: Jake Mitchell Date: Sun, 26 Jun 2016 01:00:13 +0000 Subject: [PATCH 3/5] added uuid query scope --- README.md | 14 ++++++++++++++ src/Contracts/MetaContract.php | 9 +++++++++ src/Meta.php | 11 +++++++++++ tests/MetaTest.php | 11 +++++++++++ 4 files changed, 45 insertions(+) diff --git a/README.md b/README.md index f30a5f0..04f7bab 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,20 @@ And to retrieve meta information, use the 'read' method. $post->read('author'); //returns 'Bob Saget' ``` +### Query Builder + +Let's say you need to retrieve the post that has a certain UUID (maybe you gave it out in a url or something) + +It's super easy to search for it: +``` php +Post::withUuid($uuid)->first(); +``` + +It is completely integrated into the query builder, so you can still do stuff like: +``` php +Post::withUuid($uuid)->pluck('username'); +Post::withUuid($uuid)->firstOrFail(); +``` ## Credits diff --git a/src/Contracts/MetaContract.php b/src/Contracts/MetaContract.php index 47bc3df..a438266 100644 --- a/src/Contracts/MetaContract.php +++ b/src/Contracts/MetaContract.php @@ -77,4 +77,13 @@ interface MetaContract * @return void */ public function setRawUuid( \Ramsey\Uuid\Uuid $uuid ); + + /** + * Get the model that has this UUID. + * + * @param string $uuid + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function withUuid( $uuid ); } \ No newline at end of file diff --git a/src/Meta.php b/src/Meta.php index 5f2e06f..90756aa 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -126,6 +126,17 @@ class Meta extends Model implements FoundationModel, MetaContract $this->uuid = $uuid; $this->save(); } + + /** + * Get the model that has this UUID. + * + * @param string $uuid + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function withUuid( $uuid ){ + return parent::where('uuid', $uuid); + } /** * Add the UUID and Meta columns to the table. diff --git a/tests/MetaTest.php b/tests/MetaTest.php index 1e67d58..5e26633 100644 --- a/tests/MetaTest.php +++ b/tests/MetaTest.php @@ -30,4 +30,15 @@ class MetaTest extends \PHPUnit_Framework_TestCase $model->setRawUuid($uuid); $this->assertEquals($uuid, $model->getUuid()); } + + public function testUuidQuery () + { + $model = Meta::create([ + 'meta' => serialize(['name' => 'Tony']) + ]); + + $queried = Meta::withUuid($model->getUuid())->first(); + + $this->assertEquals($model->read('name'), $queried->read('name')); + } } From e5b48176c4f4832104653d875efc31d6ecab14ff Mon Sep 17 00:00:00 2001 From: Jake Mitchell Date: Sun, 26 Jun 2016 01:12:17 +0000 Subject: [PATCH 4/5] Allow users to pass unserialized array --- src/Meta.php | 2 +- tests/MetaTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Meta.php b/src/Meta.php index 90756aa..3c2ec08 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -26,7 +26,7 @@ class Meta extends Model implements FoundationModel, MetaContract * @return callable */ public static function create( array $args = [] ){ - $args['meta'] = (isset($args['meta'])) ? $args['meta'] : serialize([]); + $args['meta'] = (isset($args['meta'])) ? ((gettype($args['meta']) === 'array') ? serialize($args['meta']) : $args['meta']) : serialize([]); $args['uuid'] = (isset($args['uuid'])) ? $args['uuid'] : Uuid::uuid4(); return parent::create($args); diff --git a/tests/MetaTest.php b/tests/MetaTest.php index 5e26633..22d2c03 100644 --- a/tests/MetaTest.php +++ b/tests/MetaTest.php @@ -34,7 +34,7 @@ class MetaTest extends \PHPUnit_Framework_TestCase public function testUuidQuery () { $model = Meta::create([ - 'meta' => serialize(['name' => 'Tony']) + 'meta' => ['name' => 'Tony'] ]); $queried = Meta::withUuid($model->getUuid())->first(); From 110ff0a15cfdcc5566f7600408689357207d0bcd Mon Sep 17 00:00:00 2001 From: Jake Mitchell Date: Sun, 26 Jun 2016 01:32:09 +0000 Subject: [PATCH 5/5] Allow users to write multiple items at once --- src/Contracts/MetaContract.php | 4 ++-- src/Meta.php | 14 +++++++++++--- tests/MetaTest.php | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Contracts/MetaContract.php b/src/Contracts/MetaContract.php index a438266..7de87df 100644 --- a/src/Contracts/MetaContract.php +++ b/src/Contracts/MetaContract.php @@ -25,12 +25,12 @@ interface MetaContract /** * Adds the key-value pair into the serialized data set. * - * @param string|int $key + * @param string|int|array $keyOrArray * @param string|int|float|array|bool|null $value * * @return void */ - public function write( $key, $value ); + public function write( $keyOrArray, $value = null ); /** * Get the serialized value of the meta info. diff --git a/src/Meta.php b/src/Meta.php index 3c2ec08..8c558ce 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -52,14 +52,22 @@ class Meta extends Model implements FoundationModel, MetaContract /** * Adds the key-value pair into the serialized data set. * - * @param string|int $key + * @param string|int|array $keyOrArray * @param string|int|float|array|bool|null $value * * @return void */ - public function write( $key, $value ){ + public function write( $keyOrArray, $value = null ){ $meta = unserialize( $this->meta ); - $meta[ $key ] = $value; + + if( is_array( $keyOrArray ) ){ + foreach( $keyOrArray as $key => $val ){ + $meta[ $key ] = $val; + } + } else { + $meta[ $keyOrArray ] = $value; + } + $meta = serialize( $meta ); $this->meta = $meta; $this->save(); diff --git a/tests/MetaTest.php b/tests/MetaTest.php index 22d2c03..b155735 100644 --- a/tests/MetaTest.php +++ b/tests/MetaTest.php @@ -13,11 +13,21 @@ class MetaTest extends \PHPUnit_Framework_TestCase $model->write('name', 'John'); $model->write('age', 15); - $model->write('email', 'Johnny@appleseed.com'); + $model->write('true', false); + + $model->write([ + 'food' => 'taco', + 'old' => 'spice', + 'new' => 1935 + ]); $this->assertEquals('John', $model->read('name')); $this->assertEquals(15, $model->read('age')); - $this->assertEquals('Johnny@appleseed.com', $model->read('email')); + $this->assertEquals(false, $model->read('true')); + + $this->assertEquals('taco', $model->read('food')); + $this->assertEquals('spice', $model->read('old')); + $this->assertEquals(1935, $model->read('new')); } public function testUuid ()