diff --git a/app/Services/XenforoApiService.php b/app/Services/XenforoApiService.php index 61c805b..1dd1a6e 100644 --- a/app/Services/XenforoApiService.php +++ b/app/Services/XenforoApiService.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Models\Entry; +use App\Models\News; use Illuminate\Http\Client\ConnectionException; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Http; @@ -104,10 +105,10 @@ class XenforoApiService { if( !$entry->comments_thread_id || $entry->comments_thread_id <= 0 ){ $data = [ 'node_id' => config('xenforo.comments_node_id'), - 'title' => $entry->complete_title, + 'title' => $entry->complete_title ?? $entry->title, 'message' => $entry->description, - 'prefix_id' => config('xenforo.comments_prefixes')[$entry->type] ?? 1, - 'custom_fields' => [ 'entry_id' => $entry->id ], + 'prefix_id' => config('xenforo.comments_prefixes')[$entry->type ?? "news"] ?? 1, + 'custom_fields' => $entry->type ? [ 'entry_id' => $entry->id ] : [ 'news_id' => $entry->id ], 'discussion_open' => true, ];