optimizations
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user