Improve topbar
This commit is contained in:
@@ -75,7 +75,17 @@ class XenforoApiService {
|
||||
}
|
||||
|
||||
return Cache::remember("xf_alerts_{$userId}", 60, function() use($userId) {
|
||||
return $this->get("alerts?page=1&cutoff=7days", $userId);
|
||||
$result = $this->get("alerts?page=1&cutoff=7days", $userId);
|
||||
|
||||
if (is_array($result)) {
|
||||
if (isset($result['alerts'])) {
|
||||
$result['alerts'] = collect($result['alerts'])->take(8)->all();
|
||||
} else {
|
||||
$result = collect($result)->take(8)->all();
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,7 +98,17 @@ class XenforoApiService {
|
||||
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);
|
||||
$result = $this->get("conversations?page=1&receiver_id={$userId}", $userId);
|
||||
|
||||
if (is_array($result)) {
|
||||
if (isset($result['conversations'])) {
|
||||
$result['conversations'] = collect($result['conversations'])->take(8)->all();
|
||||
} else {
|
||||
$result = collect($result)->take(8)->all();
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user