Initial Commit
This commit is contained in:
@@ -69,4 +69,33 @@ class StoryController extends Controller
|
||||
Story::where('id', $id)->update(['viewed_at' => now()]);
|
||||
return response()->json(['ok' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a single story item by its own id, regardless of whether it's
|
||||
* still active — used for opening a story someone shared in a DM long
|
||||
* after it expired from the live tray.
|
||||
*/
|
||||
public function showItem(string $id): JsonResponse
|
||||
{
|
||||
$item = Story::find($id);
|
||||
|
||||
if (! $item) {
|
||||
return response()->json(['message' => 'Story not found.'], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'username' => $item->username,
|
||||
'profile_pic_url' => $item->profile_pic_url,
|
||||
'start_index' => 0,
|
||||
'items' => [[
|
||||
'id' => $item->id,
|
||||
'code' => $item->code,
|
||||
'is_video' => $item->is_video,
|
||||
'image_url' => $item->image_url,
|
||||
'video_url' => $item->video_url,
|
||||
'accessibility_caption' => $item->accessibility_caption,
|
||||
'taken_at' => $item->taken_at,
|
||||
]],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user