Browse Source

Update StoryComposeController, add StoryIndexService support

Daniel Supernault 3 tuần trước cách đây
mục cha
commit
6c701b335d
1 tập tin đã thay đổi với 7 bổ sung0 xóa
  1. 7 0
      app/Http/Controllers/StoryComposeController.php

+ 7 - 0
app/Http/Controllers/StoryComposeController.php

@@ -14,6 +14,7 @@ use App\Notification;
 use App\Report;
 use App\Services\FollowerService;
 use App\Services\MediaPathService;
+use App\Services\StoryIndexService;
 use App\Services\StoryService;
 use App\Services\UserRoleService;
 use App\Status;
@@ -222,6 +223,9 @@ class StoryComposeController extends Controller
         $story->can_react = $request->input('can_react');
         $story->save();
 
+        $index = app(StoryIndexService::class);
+        $index->indexStory($story);
+
         StoryService::delLatest($story->profile_id);
         StoryFanout::dispatch($story)->onQueue('story');
         StoryService::addRotateQueue($story->id);
@@ -243,6 +247,9 @@ class StoryComposeController extends Controller
         $story->active = false;
         $story->save();
 
+        $index = app(StoryIndexService::class);
+        $index->removeStory($story->id, $story->profile_id);
+
         StoryDelete::dispatch($story)->onQueue('story');
 
         return [