Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: spatie/laravel-binary-uuid
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.3.0
Choose a base ref
...
head repository: spatie/laravel-binary-uuid
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 11 commits
  • 4 files changed
  • 5 contributors

Commits on Oct 9, 2018

  1. Copy the full SHA
    972b79c View commit details
  2. Copy the full SHA
    9c0caa4 View commit details
  3. Copy the full SHA
    3387f58 View commit details

Commits on Oct 10, 2018

  1. Merge pull request #75 from TJVB/connect_the_codecoverage_to_scrutinizer

    Connect the codecoverage to scrutinizer
    brendt authored Oct 10, 2018
    Copy the full SHA
    8b6c33b View commit details

Commits on Oct 18, 2018

  1. run tests on php 7.3

    akoepcke authored Oct 18, 2018
    Copy the full SHA
    63d02dc View commit details
  2. Merge pull request #78 from akoepcke/patch-1

    run tests on php 7.3
    freekmurze authored Oct 18, 2018
    Copy the full SHA
    f77a374 View commit details

Commits on Oct 23, 2018

  1. Updated readme for 1.3.0

    louisl committed Oct 23, 2018
    Copy the full SHA
    16a508b View commit details
  2. typo

    louisl committed Oct 23, 2018
    Copy the full SHA
    97dc33a View commit details

Commits on Oct 24, 2018

  1. Merge pull request #82 from louisl/feature/update-readme

    Feature/update readme
    brendt authored Oct 24, 2018
    Copy the full SHA
    2aed784 View commit details

Commits on Nov 29, 2018

  1. Update README.md

    freekmurze authored Nov 29, 2018
    Copy the full SHA
    611f107 View commit details

Commits on Dec 10, 2018

  1. Update README.md

    freekmurze authored Dec 10, 2018
    Copy the full SHA
    2e081a6 View commit details
Showing with 35 additions and 1 deletion.
  1. +4 −0 .scrutinizer.yml
  2. +1 −0 .travis.yml
  3. +28 −0 README.md
  4. +2 −1 composer.json
4 changes: 4 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -17,3 +17,7 @@ checks:
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 4
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ language: php
php:
- 7.1
- 7.2
- 7.3

env:
matrix:
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
**THIS PACKAGE IS NOT MAINTAINED ANYMORE**

Alternatives: https://github.com/michaeldyrynda/laravel-efficient-uuid & https://github.com/michaeldyrynda/laravel-model-uuid

# Using optimised binary UUIDs in Laravel

[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-binary-uuid.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-binary-uuid)
[![Build Status](https://img.shields.io/travis/spatie/laravel-binary-uuid/master.svg?style=flat-square)](https://travis-ci.org/spatie/laravel-binary-uuid)
[![Code coverage](https://scrutinizer-ci.com/g/spatie/laravel-binary-uuid/badges/coverage.png)](https://scrutinizer-ci.com/g/spatie/laravel-binary-uuid)
[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/laravel-binary-uuid.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/laravel-binary-uuid)
[![StyleCI](https://styleci.io/repos/110949385/shield?branch=master)](https://styleci.io/repos/110949385)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-binary-uuid.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-binary-uuid)
@@ -97,6 +102,8 @@ class TestModel extends Model

In your JSON you will see `uuid` and `country_uuid` in their textual representation. If you're also making use of composite primary keys, the above works well enough too. Just include your keys in the `$uuids` array or override the `getKeyName()` method on your model and return your composite primary keys as an array of keys. You can also customize the UUID text attribute suffix name. In the code above, instead of '\_text' it's '\_str'.

The `$uuids` array in your model defines fields that will be converted to uuid strings when retrieved and converted to binary when written to the database. You do not need to define these fields in the `$casts` array in your model.

#### A note on the `uuid` blueprint method

Laravel currently does not allow adding new blueprint methods which can be used out of the box.
@@ -170,6 +177,27 @@ $models = MyModel::withUuid([
])->get();
```

Note: Version 1.3.0 added simplified syntax for finding data using a uuid string.

```php
$uuid = 'ff8683dc-cadd-11e7-9547-8c85901eed2e'; // UUID from eg. the URL.

$model = MyModel::find($uuid);

$model = MyModel::findOrFail($uuid);
```

Version 1.3.0 query for multiple UUIDs.

```php
$uuids = [
'ff8683dc-cadd-11e7-9547-8c85901eed2e',
'ff8683ab-cadd-11e7-9547-8c85900eed2t',
];

$model = MyModel::findMany($uuids);
```

#### Querying relations

You can also use the `withUuid` scope to query relation fields by specifying a field to query.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -22,7 +22,8 @@
},
"require-dev": {
"orchestra/testbench": "^3.5|~3.6.0|~3.7.0",
"phpunit/phpunit": "^6.5|^7.0"
"phpunit/phpunit": "^6.5|^7.0",
"scrutinizer/ocular": "^1.5"
},
"autoload": {
"psr-4": {