From 53bcba28ef98f4acb12e1073cb7134e50ac646b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20J=C3=B8nsson?= Date: Thu, 7 Dec 2023 12:49:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Add=20productNumber=20to=20Produ?= =?UTF-8?q?ct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Resources/Product.php | 4 ++++ tests/Unit/InvoiceTest.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/Resources/Product.php b/src/Resources/Product.php index da4f34e..c5e4ef6 100644 --- a/src/Resources/Product.php +++ b/src/Resources/Product.php @@ -7,6 +7,7 @@ use MorningTrain\Economic\Attributes\Resources\GetCollection; use MorningTrain\Economic\Attributes\Resources\GetSingle; use MorningTrain\Economic\Attributes\Resources\Properties\Filterable; +use MorningTrain\Economic\Attributes\Resources\Properties\PrimaryKey; use MorningTrain\Economic\Attributes\Resources\Properties\ResourceType; use MorningTrain\Economic\Attributes\Resources\Properties\Sortable; use MorningTrain\Economic\Classes\EconomicCollection; @@ -73,6 +74,9 @@ class Product extends Resource #[Sortable] public string $year; + #[PrimaryKey] + public int $productNumber; + public static function create(DateTime $fromDate, DateTime $toDate): static { return static::createRequest(compact('fromDate', 'toDate')); diff --git a/tests/Unit/InvoiceTest.php b/tests/Unit/InvoiceTest.php index ed25bd5..82bcf60 100644 --- a/tests/Unit/InvoiceTest.php +++ b/tests/Unit/InvoiceTest.php @@ -31,6 +31,9 @@ ], 'lines' => [ [ + 'product' => [ + 'productNumber' => 1, + ], 'quantity' => 1, 'unitNetPrice' => 500, ],