Finish Notifications -> Conversation

This commit is contained in:
2026-05-25 09:55:47 +02:00
parent a778222564
commit 250509055b
11 changed files with 238 additions and 8 deletions

View File

@@ -55,4 +55,11 @@ class DynamicLoadController extends Controller
return response()->json( ['success' => true] );
}
public function getConversations( Request $request ){
$service = app(XenforoApiService::class);
$data = $service->getConversations(\Auth::user()->user_id);
return response()->json( $data );
}
}

View File

@@ -49,8 +49,9 @@ class XenforoApiService {
public function getUserAlerts(int $userId): mixed
{
if( app(XenforoService::class)->getXfUser($userId)?->alerts_unviewed > 0 )
return $this->get("alerts?page=1&cutoff=7days", $userId);
if( app(XenforoService::class)->getXfUser($userId)?->alerts_unviewed > 0 ) {
Cache::forget("xf_alerts_{$userId}");
}
return Cache::remember("xf_alerts_{$userId}", 60, function() use($userId) {
return $this->get("alerts?page=1&cutoff=7days", $userId);
@@ -63,4 +64,11 @@ class XenforoApiService {
$this->post("alerts/marl-all", $userId );
}
public function getConversations(int $userId): mixed
{
return Cache::remember("xf_conversations_{$userId}", 60, function() use($userId) {
return $this->get("conversations?page=1&receiver_id={$userId}", $userId);
});
}
}