From ebb3a658c7a133a90736fd70ef36ce49909f6643 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 26 Jun 2025 11:33:12 +1000 Subject: [PATCH] Make a default for contract_term when the model returns NULL --- app/Models/Product/Type.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/Product/Type.php b/app/Models/Product/Type.php index 06fcdee..9cb7512 100644 --- a/app/Models/Product/Type.php +++ b/app/Models/Product/Type.php @@ -56,11 +56,11 @@ abstract class Type extends Model implements ProductItem * The product contract term is the highest of our defined contract_term (in Products/*) vs the suppliers * contract term (defined in Supplier/*). * - * @param int $val + * @param int|null $val * @return int */ - public function getContractTermAttribute(int $val): int + public function getContractTermAttribute(?int $val): int { - return max($val,$this->supplied->contract_term); + return max($val ?: 0,$this->supplied->contract_term); } } \ No newline at end of file