Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.4, 8.3, 8.2]
laravel: ['^12.0']
php: [8.5, 8.4, 8.3, 8.2]
laravel: [^12.0, ^13.0]
exclude:
- laravel: ^13.0
php: 8.2

name: P${{ matrix.php }} - L${{ matrix.laravel }}

Expand Down
110 changes: 55 additions & 55 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
{
"name": "dyrynda/laravel-model-uuid",
"description": "This package allows you to easily work with UUIDs in your Laravel models.",
"license": "MIT",
"keywords": [
"eloquent",
"laravel",
"model",
"uuid"
],
"authors": [
{
"name": "Michael Dyrynda",
"email": "michael@dyrynda.com.au",
"homepage": "https://dyrynda.com.au"
}
],
"require": {
"php": "^8.2",
"illuminate/container": "^12.0",
"illuminate/contracts": "^12.0",
"illuminate/database": "^12.0",
"illuminate/events": "^12.0",
"illuminate/support": "^12.0",
"ramsey/uuid": "^4.7",
"spatie/laravel-package-tools": "^1.19"
},
"autoload": {
"psr-4": {
"Dyrynda\\Database\\Support\\": "src/"
}
},
"require-dev": {
"laravel/legacy-factories": "^1.3",
"laravel/pint": "^1.20",
"orchestra/testbench": "^10.0",
"phpunit/phpunit": "^11.5.3"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-main": "8.x-dev"
"name": "dyrynda/laravel-model-uuid",
"description": "This package allows you to easily work with UUIDs in your Laravel models.",
"license": "MIT",
"keywords": [
"eloquent",
"laravel",
"model",
"uuid"
],
"authors": [
{
"name": "Michael Dyrynda",
"email": "michael@dyrynda.com.au",
"homepage": "https://dyrynda.com.au"
}
],
"require": {
"php": "^8.2",
"illuminate/container": "^12.0|^13.0",
"illuminate/contracts": "^12.0|^13.0",
"illuminate/database": "^12.0|^13.0",
"illuminate/events": "^12.0|^13.0",
"illuminate/support": "^12.0|^13.0",
"ramsey/uuid": "^4.7",
"spatie/laravel-package-tools": "^1.39"
},
"autoload": {
"psr-4": {
"Dyrynda\\Database\\Support\\": "src/"
}
},
"require-dev": {
"laravel/legacy-factories": "^1.3",
"laravel/pint": "^1.20",
"orchestra/testbench": "^10.0|^11.0",
"phpunit/phpunit": "^11.5.3|^12.5.12"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"laravel": {
"providers": [
"Dyrynda\\Database\\Support\\LaravelModelUuidServiceProvider"
]
"extra": {
"branch-alias": {
"dev-main": "8.x-dev"
},
"laravel": {
"providers": [
"Dyrynda\\Database\\Support\\LaravelModelUuidServiceProvider"
]
}
}
}
}
5 changes: 3 additions & 2 deletions src/Casts/EfficientUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
namespace Dyrynda\Database\Support\Casts;

use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
use Ramsey\Uuid\Uuid;

class EfficientUuid implements CastsAttributes
{
/**
* Transform the attribute from the underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param Model $model
* @param mixed $value
* @return mixed
*/
Expand All @@ -26,7 +27,7 @@ public function get($model, string $key, $value, array $attributes)
/**
* Transform the attribute to its underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param Model $model
* @param mixed $value
* @return array
*/
Expand Down
8 changes: 4 additions & 4 deletions src/GeneratesUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function resolveUuidVersion(): string
/**
* Scope queries to find by UUID.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param Builder $query
* @param string|array $uuid
* @param string $uuidColumn
*/
Expand All @@ -137,7 +137,7 @@ public function scopeWhereUuid($query, $uuid, $uuidColumn = null): Builder
/**
* Scope queries to find by UUID.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param Builder $query
* @param string|array $uuid
* @param string $uuidColumn
*/
Expand All @@ -155,7 +155,7 @@ public function scopeWhereNotUuid($query, $uuid, $uuidColumn = null): Builder
/**
* Convert a single UUID or array of UUIDs to bytes.
*
* @param \Illuminate\Contracts\Support\Arrayable|array|string $uuid
* @param Arrayable|array|string $uuid
*/
protected function bytesFromUuid($uuid): array
{
Expand All @@ -173,7 +173,7 @@ protected function bytesFromUuid($uuid): array
/**
* Normalises a single or array of input UUIDs, filtering any invalid UUIDs.
*
* @param \Illuminate\Contracts\Support\Arrayable|array|string $uuid
* @param Arrayable|array|string $uuid
*/
protected function normaliseUuids($uuid): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/LaravelModelUuidServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function packageRegistered()
});

Blueprint::macro('efficientUuid', function ($column): ColumnDefinition {
/** @var \Illuminate\Database\Schema\Blueprint $this */
/** @var Blueprint $this */
return $this->addColumn('efficientUuid', $column);
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/Rules/EfficientUuidExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Dyrynda\Database\Support\Rules;

use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Contracts\Validation\Rule;
use Ramsey\Uuid\Uuid;

class EfficientUuidExists implements Rule
{
/** @var \Dyrynda\Database\Support\GeneratesUuid */
/** @var GeneratesUuid */
protected $model;

/** @var string */
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/EfficientUuidExistsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EfficientUuidExistsRuleTest extends TestCase
#[Test]
public function it_passes_valid_existing_uuid()
{
/** @var \Tests\Fixtures\EfficientUuidPost $post */
/** @var EfficientUuidPost $post */
$post = factory(EfficientUuidPost::class)->create();

$rule = new EfficientUuidExists(EfficientUuidPost::class, 'efficient_uuid');
Expand Down Expand Up @@ -44,7 +44,7 @@ public function it_fails_on_any_non_uuid_invalid_strings()
#[Test]
public function it_works_with_custom_uuid_column_name()
{
/** @var \Tests\Fixtures\EfficientUuidPost $post */
/** @var EfficientUuidPost $post */
$post = factory(EfficientUuidPost::class)->create();

$rule = new EfficientUuidExists(EfficientUuidPost::class, 'custom_efficient_uuid');
Expand Down
3 changes: 2 additions & 1 deletion tests/database/factories/CommentFactory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */
/** @var Factory $factory */

use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factory;
use Tests\Fixtures\Comment;
use Tests\Fixtures\Post;

Expand Down
3 changes: 2 additions & 1 deletion tests/database/factories/PostFactory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */
/** @var Factory $factory */

use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factory;
use Tests\Fixtures\CustomCastUuidPost;
use Tests\Fixtures\CustomUuidPost;
use Tests\Fixtures\CustomUuidRouteBoundPost;
Expand Down
Loading