You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -8,9 +8,13 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ArticleService
|
||||
{
|
||||
public function getArticles(bool $paginate = false, int $perPage = 8): array|Collection|LengthAwarePaginator
|
||||
/**
|
||||
* @return Collection<int, WebsiteArticle>|LengthAwarePaginator<int, WebsiteArticle>
|
||||
*/
|
||||
public function getArticles(bool $paginate = false, int $perPage = 8): Collection|LengthAwarePaginator
|
||||
{
|
||||
$query = WebsiteArticle::with(['user' => function ($query): void {
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query->select('id', 'username', 'look');
|
||||
}])->orderByDesc('id');
|
||||
|
||||
|
||||
@@ -9,11 +9,14 @@ use Illuminate\Http\Request;
|
||||
|
||||
class ReactionService
|
||||
{
|
||||
/**
|
||||
* @return array{success: bool, added?: bool, username?: string}
|
||||
*/
|
||||
public function toggleReaction(WebsiteArticle $article, User $user, Request $request): array
|
||||
{
|
||||
$reaction = $request->get('reaction');
|
||||
|
||||
if (! is_string($reaction) || ! in_array($reaction, config('habbo.reactions'))) {
|
||||
if (! is_string($reaction) || ! in_array($reaction, (array) config('habbo.reactions'))) {
|
||||
return ['success' => false];
|
||||
}
|
||||
|
||||
@@ -29,7 +32,7 @@ class ReactionService
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'added' => $existingReaction?->active ?? true,
|
||||
'added' => $existingReaction ? $existingReaction->active : true,
|
||||
'username' => $user->username,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user