optimizations

This commit is contained in:
2026-03-28 19:15:39 +01:00
parent 0b25d9570a
commit cab4fbd83e
509 changed files with 1016804 additions and 1605 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Forum;
use App\Http\Controllers\Controller;
use App\Services\Activity\UserActivityService;
use App\Models\ForumCategory;
use App\Models\ForumPost;
use App\Models\ForumPostReport;
@@ -229,6 +230,12 @@ class ForumController extends Controller
'edited_at' => null,
]);
try {
app(UserActivityService::class)->logForumPost((int) $user->id, (int) $thread->id, [
'category_id' => (int) $category->id,
]);
} catch (\Throwable) {}
return redirect()->route('forum.thread.show', ['thread' => $thread->id, 'slug' => $thread->slug]);
}
@@ -242,7 +249,7 @@ class ForumController extends Controller
'content' => ['required', 'string', 'min:2'],
]);
ForumPost::create([
$post = ForumPost::create([
'thread_id' => $thread->id,
'user_id' => (int) $user->id,
'content' => $validated['content'],
@@ -250,6 +257,12 @@ class ForumController extends Controller
'edited_at' => null,
]);
try {
app(UserActivityService::class)->logForumReply((int) $user->id, (int) $post->id, [
'thread_id' => (int) $thread->id,
]);
} catch (\Throwable) {}
$thread->last_post_at = now();
$thread->save();