Finish Notifications -> Conversation
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user