fix: prevent error 500 on article pages

This commit is contained in:
Valentin Lab
2025-11-03 11:35:16 +01:00
parent abb32e32b9
commit ef1964d472
2 changed files with 25 additions and 9 deletions

View File

@@ -135,8 +135,11 @@ class Articles
$data['specie'] = $article->product ? $article->product->description : '';
break;
case 'App\Models\Shop\Merchandise':
$data['merchandise'] = $article->product ? $article->product->description : '';
$data['producer'] = $article->product->producer->description;
$merchandise = $article->product;
$data['merchandise'] = $merchandise ? ($merchandise->description ?? '') : '';
if ($merchandise && $merchandise->producer) {
$data['producer'] = $merchandise->producer->description ?? '';
}
break;
default:
}