Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/Http/Controllers/Api/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function register(RegisterRequest $request): JsonResponse

$user->assignRole('company');

//TODO: Send new company registration notification on Slack
// TODO: Send new company registration notification on Slack
event(new ApiRegistered($user));

return response()->json(
Expand Down Expand Up @@ -81,9 +81,9 @@ public function googleAuthenticator(Request $request): JsonResponse
'avatar' => $socialUser['photoUrl'],
]);

//TODO: Send welcome email to user 1 hour after registration
// TODO: Send welcome email to user 1 hour after registration

//TODO: Send new company registration notification on Slack
// TODO: Send new company registration notification on Slack

$user->last_login_at = Carbon::now();
$user->last_login_ip = $request->ip();
Expand Down
8 changes: 7 additions & 1 deletion app/Livewire/Pages/Forum/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class Index extends Component
#[Url(as: 'no-replies')]
public ?string $unAnswered = null;

#[Url]
#[Url(as: 'follow')]
public ?string $subscribe = null;

public ?Channel $currentChannel = null;
Expand Down Expand Up @@ -129,6 +129,12 @@ protected function applyChannel(Builder $query): Builder

protected function applySubscribe(Builder $query): Builder
{
if (Auth::check() && $this->subscribe) {
$query->whereHas('subscribes', function (Builder $query): void {
$query->where('user_id', Auth::id());
});
}

return $query;
}

Expand Down
6 changes: 2 additions & 4 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,8 @@ public function scopeWithCounts(Builder $query): Builder
'articles as articles_count',
'threads as threads_count',
'replyAble as replies_count',
'replyAble as solutions_count' => function (Builder $query) {
return $query->join('threads', 'threads.solution_reply_id', '=', 'replies.id')
->where('replyable_type', 'thread');
},
'replyAble as solutions_count' => fn (Builder $query) => $query->join('threads', 'threads.solution_reply_id', '=', 'replies.id')
->where('replyable_type', 'thread'),
]);
}

Expand Down
10 changes: 4 additions & 6 deletions app/Widgets/MostActiveUsersPerWeek.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ public function run(): View
$users = User::with('activities')
->withCount('activities')
->verifiedUsers()
->whereHas('activities', function (Builder $query) {
return $query->whereBetween('created_at', [
now()->startOfWeek(),
now()->endOfWeek(),
]);
})
->whereHas('activities', fn (Builder $query) => $query->whereBetween('created_at', [
now()->startOfWeek(),
now()->endOfWeek(),
]))
->orderByDesc('activities_count')
->limit(5)
->get();
Expand Down
Loading
Loading