Compare commits

..

2 commits

Author SHA1 Message Date
Benjamin Nussbaum
ffd1cf0d7e fix(#168): ensure trmnlp_id is unset during plugin duplication to prevent unique constraint violation
Some checks failed
tests / ci (push) Has been cancelled
2026-01-21 23:16:27 +01:00
Benjamin Nussbaum
a095268c30 chore: update dependencies 2026-01-21 23:02:46 +01:00
3 changed files with 68 additions and 48 deletions

View file

@ -594,7 +594,7 @@ class Plugin extends Model
// Get all attributes except id and uuid
// Use toArray() to get cast values (respects JSON casts)
$attributes = $this->toArray();
unset($attributes['id'], $attributes['uuid']);
unset($attributes['id'], $attributes['uuid'], $attributes['trmnlp_id']);
// Handle render_markup_view - copy file content to render_markup
if ($this->render_markup_view) {

94
composer.lock generated
View file

@ -62,16 +62,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.369.14",
"version": "3.369.17",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "b40eb1177d2e621c18cd797ca6cc9efb5a0e99d9"
"reference": "8bdccd2f8e54c5cd170b22f52414171e19226fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b40eb1177d2e621c18cd797ca6cc9efb5a0e99d9",
"reference": "b40eb1177d2e621c18cd797ca6cc9efb5a0e99d9",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8bdccd2f8e54c5cd170b22f52414171e19226fd1",
"reference": "8bdccd2f8e54c5cd170b22f52414171e19226fd1",
"shasum": ""
},
"require": {
@ -153,9 +153,9 @@
"support": {
"forum": "https://github.com/aws/aws-sdk-php/discussions",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.369.14"
"source": "https://github.com/aws/aws-sdk-php/tree/3.369.17"
},
"time": "2026-01-15T19:10:54+00:00"
"time": "2026-01-21T19:09:32+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -1894,16 +1894,16 @@
},
{
"name": "laravel/framework",
"version": "v12.47.0",
"version": "v12.48.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "ab8114c2e78f32e64eb238fc4b495bea3f8b80ec"
"reference": "0f0974a9769378ccd9c9935c09b9927f3a606830"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/ab8114c2e78f32e64eb238fc4b495bea3f8b80ec",
"reference": "ab8114c2e78f32e64eb238fc4b495bea3f8b80ec",
"url": "https://api.github.com/repos/laravel/framework/zipball/0f0974a9769378ccd9c9935c09b9927f3a606830",
"reference": "0f0974a9769378ccd9c9935c09b9927f3a606830",
"shasum": ""
},
"require": {
@ -2016,7 +2016,7 @@
"league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10",
"opis/json-schema": "^2.4.1",
"orchestra/testbench-core": "^10.8.1",
"orchestra/testbench-core": "^10.9.0",
"pda/pheanstalk": "^5.0.6|^7.0.0",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
@ -2112,7 +2112,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2026-01-13T15:29:06+00:00"
"time": "2026-01-20T16:12:36+00:00"
},
{
"name": "laravel/prompts",
@ -2175,16 +2175,16 @@
},
{
"name": "laravel/sanctum",
"version": "v4.2.3",
"version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/laravel/sanctum.git",
"reference": "47d26f1d310879ff757b971f5a6fc631d18663fd"
"reference": "dadd2277ff0f05cdb435c8b6a0bcedcf3b5519a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/47d26f1d310879ff757b971f5a6fc631d18663fd",
"reference": "47d26f1d310879ff757b971f5a6fc631d18663fd",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/dadd2277ff0f05cdb435c8b6a0bcedcf3b5519a9",
"reference": "dadd2277ff0f05cdb435c8b6a0bcedcf3b5519a9",
"shasum": ""
},
"require": {
@ -2234,7 +2234,7 @@
"issues": "https://github.com/laravel/sanctum/issues",
"source": "https://github.com/laravel/sanctum"
},
"time": "2026-01-11T18:20:25+00:00"
"time": "2026-01-15T14:37:16+00:00"
},
{
"name": "laravel/serializable-closure",
@ -3128,16 +3128,16 @@
},
{
"name": "livewire/flux",
"version": "v2.10.2",
"version": "v2.11.0",
"source": {
"type": "git",
"url": "https://github.com/livewire/flux.git",
"reference": "e7a93989788429bb6c0a908a056d22ea3a6c7975"
"reference": "163fd7333468d527153da6100f3c8e8e402a8f90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/flux/zipball/e7a93989788429bb6c0a908a056d22ea3a6c7975",
"reference": "e7a93989788429bb6c0a908a056d22ea3a6c7975",
"url": "https://api.github.com/repos/livewire/flux/zipball/163fd7333468d527153da6100f3c8e8e402a8f90",
"reference": "163fd7333468d527153da6100f3c8e8e402a8f90",
"shasum": ""
},
"require": {
@ -3145,7 +3145,7 @@
"illuminate/support": "^10.0|^11.0|^12.0",
"illuminate/view": "^10.0|^11.0|^12.0",
"laravel/prompts": "^0.1|^0.2|^0.3",
"livewire/livewire": "^3.7.3|^4.0",
"livewire/livewire": "^3.7.4|^4.0",
"php": "^8.1",
"symfony/console": "^6.0|^7.0"
},
@ -3188,22 +3188,22 @@
],
"support": {
"issues": "https://github.com/livewire/flux/issues",
"source": "https://github.com/livewire/flux/tree/v2.10.2"
"source": "https://github.com/livewire/flux/tree/v2.11.0"
},
"time": "2025-12-19T02:11:45+00:00"
"time": "2026-01-21T09:22:09+00:00"
},
{
"name": "livewire/livewire",
"version": "v4.0.1",
"version": "v4.0.2",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "c7539589d5af82691bef17da17ce4e289269f8d9"
"reference": "57fd2f193072560f8615e513972db5fb9dc93501"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/c7539589d5af82691bef17da17ce4e289269f8d9",
"reference": "c7539589d5af82691bef17da17ce4e289269f8d9",
"url": "https://api.github.com/repos/livewire/livewire/zipball/57fd2f193072560f8615e513972db5fb9dc93501",
"reference": "57fd2f193072560f8615e513972db5fb9dc93501",
"shasum": ""
},
"require": {
@ -3258,7 +3258,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v4.0.1"
"source": "https://github.com/livewire/livewire/tree/v4.0.2"
},
"funding": [
{
@ -3266,7 +3266,7 @@
"type": "github"
}
],
"time": "2026-01-14T18:40:41+00:00"
"time": "2026-01-21T09:09:58+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -8976,16 +8976,16 @@
},
{
"name": "larastan/larastan",
"version": "v3.8.1",
"version": "v3.9.1",
"source": {
"type": "git",
"url": "https://github.com/larastan/larastan.git",
"reference": "ff3725291bc4c7e6032b5a54776e3e5104c86db9"
"reference": "4b92d9627f779fd32bdc16f53f8ce88c50446ff5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/ff3725291bc4c7e6032b5a54776e3e5104c86db9",
"reference": "ff3725291bc4c7e6032b5a54776e3e5104c86db9",
"url": "https://api.github.com/repos/larastan/larastan/zipball/4b92d9627f779fd32bdc16f53f8ce88c50446ff5",
"reference": "4b92d9627f779fd32bdc16f53f8ce88c50446ff5",
"shasum": ""
},
"require": {
@ -9054,7 +9054,7 @@
],
"support": {
"issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v3.8.1"
"source": "https://github.com/larastan/larastan/tree/v3.9.1"
},
"funding": [
{
@ -9062,7 +9062,7 @@
"type": "github"
}
],
"time": "2025-12-11T16:37:35+00:00"
"time": "2026-01-21T09:15:17+00:00"
},
{
"name": "laravel/boost",
@ -10430,11 +10430,11 @@
},
{
"name": "phpstan/phpstan",
"version": "2.1.33",
"version": "2.1.36",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f",
"reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/2132e5e2361d11d40af4c17faa16f043269a4cf3",
"reference": "2132e5e2361d11d40af4c17faa16f043269a4cf3",
"shasum": ""
},
"require": {
@ -10479,7 +10479,7 @@
"type": "github"
}
],
"time": "2025-12-05T10:24:31+00:00"
"time": "2026-01-21T13:58:26+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -10922,21 +10922,21 @@
},
{
"name": "rector/rector",
"version": "2.3.1",
"version": "2.3.4",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "9afc1bb43571b25629f353c61a9315b5ef31383a"
"reference": "9227d7a24b0f23ae941057509364f948d5da9ab2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9afc1bb43571b25629f353c61a9315b5ef31383a",
"reference": "9afc1bb43571b25629f353c61a9315b5ef31383a",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9227d7a24b0f23ae941057509364f948d5da9ab2",
"reference": "9227d7a24b0f23ae941057509364f948d5da9ab2",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.1.33"
"phpstan/phpstan": "^2.1.36"
},
"conflict": {
"rector/rector-doctrine": "*",
@ -10970,7 +10970,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.3.1"
"source": "https://github.com/rectorphp/rector/tree/2.3.4"
},
"funding": [
{
@ -10978,7 +10978,7 @@
"type": "github"
}
],
"time": "2026-01-13T15:13:58+00:00"
"time": "2026-01-21T14:49:03+00:00"
},
{
"name": "sebastian/cli-parser",

View file

@ -821,6 +821,26 @@ test('plugin duplicate copies all attributes except id and uuid', function (): v
->and($duplicate->render_markup_view)->toBeNull();
});
test('plugin duplicate sets trmnlp_id to null to avoid unique constraint violation', function (): void {
$user = User::factory()->create();
$original = Plugin::factory()->create([
'user_id' => $user->id,
'name' => 'Plugin with trmnlp_id',
'trmnlp_id' => 'test-trmnlp-id-123',
]);
$duplicate = $original->duplicate();
// Refresh to ensure casts are applied
$original->refresh();
$duplicate->refresh();
expect($duplicate->trmnlp_id)->toBeNull()
->and($original->trmnlp_id)->toBe('test-trmnlp-id-123')
->and($duplicate->name)->toBe('Plugin with trmnlp_id (Copy)');
});
test('plugin duplicate copies render_markup_view file content to render_markup', function (): void {
$user = User::factory()->create();