|
1 | | -# TODO |
| 1 | +<p align="center"> |
| 2 | + <a href="https://github.com/goldspecdigital/laravel-eloquent-uuid"><img |
| 3 | + alt="Eloquent UUID" |
| 4 | + src="https://svgshare.com/i/DVS.svg" width="400px" |
| 5 | + ></a> |
| 6 | +</p> |
| 7 | + |
| 8 | +<p align="center"> |
| 9 | + <a href="https://github.com/goldspecdigital/laravel-eloquent-uuid"><img |
| 10 | + alt="GitHub stars" |
| 11 | + src="https://img.shields.io/github/stars/goldspecdigital/laravel-eloquent-uuid.svg?style=social" |
| 12 | + ></a> |
| 13 | +</p> |
| 14 | + |
| 15 | +<p align="center"> |
| 16 | + <a href="https://github.com/goldspecdigital/laravel-eloquent-uuid/tags"><img |
| 17 | + alt="GitHub tag (latest SemVer)" |
| 18 | + src="https://img.shields.io/github/tag/goldspecdigital/laravel-eloquent-uuid.svg" |
| 19 | + ></a> |
| 20 | + <a href="https://travis-ci.com/goldspecdigital/laravel-eloquent-uuid"><img |
| 21 | + alt="Build status" |
| 22 | + src="https://travis-ci.com/goldspecdigital/laravel-eloquent-uuid.svg?branch=master" |
| 23 | + ></a> |
| 24 | + <a href="https://packagist.org/packages/goldspecdigital/laravel-eloquent-uuid"><img |
| 25 | + alt="Packagist" |
| 26 | + src="https://img.shields.io/packagist/dt/goldspecdigital/laravel-eloquent-uuid.svg" |
| 27 | + ></a> |
| 28 | + <img |
| 29 | + alt="PHP from Packagist" |
| 30 | + src="https://img.shields.io/packagist/php-v/goldspecdigital/laravel-eloquent-uuid.svg" |
| 31 | + > |
| 32 | + <img |
| 33 | + alt="Packagist" |
| 34 | + src="https://img.shields.io/packagist/l/goldspecdigital/laravel-eloquent-uuid.svg" |
| 35 | + > |
| 36 | +</p> |
| 37 | + |
| 38 | +## Introduction |
| 39 | + |
| 40 | +A simple drop-in solution for providing UUIDv4 support for the IDs of your |
| 41 | +Eloquent models. |
| 42 | + |
| 43 | +## Installing |
| 44 | + |
| 45 | +You can install the package via composer: |
| 46 | + |
| 47 | +```bash |
| 48 | +composer require goldspecdigital/laravel-eloquent-uuid |
| 49 | +``` |
| 50 | + |
| 51 | +## Usage |
| 52 | + |
| 53 | +When creating a Eloquent model, instead of extending the standard Laravel model |
| 54 | +class, extend from the model class provided by this package: |
| 55 | + |
| 56 | +```php |
| 57 | +<?php |
| 58 | + |
| 59 | +namespace App\Models; |
| 60 | + |
| 61 | +use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Model; |
| 62 | + |
| 63 | +class BlogPost extends Model |
| 64 | +{ |
| 65 | + // |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### User model |
| 70 | + |
| 71 | +The User model that comes with a standard Laravel install has some extra |
| 72 | +configuration which is implemented in its parent class. This configuration only |
| 73 | +consists of implementing several interfaces and using several traits. |
| 74 | + |
| 75 | +A drop-in replacement has been provided which you can use just as above, by |
| 76 | +extending the User class provided by this package: |
| 77 | + |
| 78 | +```php |
| 79 | +<?php |
| 80 | + |
| 81 | +namespace App\Models; |
| 82 | + |
| 83 | +use GoldSpecDigital\LaravelEloquentUUID\Foundation\Auth\User as Authenticatable; |
| 84 | + |
| 85 | +class User extends Authenticatable |
| 86 | +{ |
| 87 | + // |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +## Running the tests |
| 92 | + |
| 93 | +To run the test suite you can use the following commands: |
| 94 | + |
| 95 | +```bash |
| 96 | +# To run both style and unit tests. |
| 97 | +composer test |
| 98 | + |
| 99 | +# To run only style tests. |
| 100 | +composer test:style |
| 101 | + |
| 102 | +# To run only unit tests. |
| 103 | +composer test:unit |
| 104 | +``` |
| 105 | + |
| 106 | +If you receive any errors from the style tests, you can automatically fix most, |
| 107 | +if not all of the issues with the following command: |
| 108 | + |
| 109 | +```bash |
| 110 | +composer fix:style |
| 111 | +``` |
| 112 | + |
| 113 | +## Contributing |
| 114 | + |
| 115 | +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of |
| 116 | +conduct, and the process for submitting pull requests to us. |
| 117 | + |
| 118 | +## Versioning |
| 119 | + |
| 120 | +We use [SemVer](http://semver.org/) for versioning. For the versions available, |
| 121 | +see the [tags on this repository](https://github.com/goldspecdigital/laravel-eloquent-uuid/tags). |
| 122 | + |
| 123 | +## Authors |
| 124 | + |
| 125 | +* [GoldSpec Digital](https://github.com/goldspecdigital) |
| 126 | + |
| 127 | +See also the list of [contributors](https://github.com/goldspecdigital/laravel-eloquent-uuid/contributors) |
| 128 | +who participated in this project. |
| 129 | + |
| 130 | +## License |
| 131 | + |
| 132 | +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) |
| 133 | +file for details. |
0 commit comments