diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cd8eb86 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e7d7c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.phpintel/ +vendor/ +composer.lock +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..91d2ba2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,16 @@ +Copyright 2021 David Villa (david@kfoobar.se) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ded6565 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Eloquent UUID trait for Laravel + +UUID trait for models in Laravel 5.5+ + +## Installation + +You can install the package via composer: + +``` +$ composer require kfoobar/laravel-uuid +``` + +## Basic Usage + +First, add the KFoobar\Uuid\Traits\HasUuid trait to your model(s): + +``` +class Post extends Model +{ + use HasUuid; +} +``` + +## Contributing + +Contributions are welcome! + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..a588880 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "kfoobar/laravel-uuid", + "description": "Eloquent UUID trait for Laravel", + "license": "MIT", + "authors": [ + { + "name": "KFoobar", + "email": "david@kfoobar.se" + } + ], + "minimum-stability": "dev", + "require": { + "php": ">=7.3", + "illuminate/support": "^5.5|^6|^7|^8|^9" + }, + "autoload": { + "psr-4": { + "KFoobar\\LaravelUuid\\": "src/KFoobar/LaravelUuid/" + } + } +} diff --git a/src/LaravelUuid/Traits/HasUuid.php b/src/LaravelUuid/Traits/HasUuid.php new file mode 100644 index 0000000..01ab1ff --- /dev/null +++ b/src/LaravelUuid/Traits/HasUuid.php @@ -0,0 +1,8 @@ +