Make a default for contract_term when the model returns NULL
This commit is contained in:
parent
b103b39abc
commit
ebb3a658c7
@ -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
|
* The product contract term is the highest of our defined contract_term (in Products/*) vs the suppliers
|
||||||
* contract term (defined in Supplier/*).
|
* contract term (defined in Supplier/*).
|
||||||
*
|
*
|
||||||
* @param int $val
|
* @param int|null $val
|
||||||
* @return int
|
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user