Update comment apis
This commit is contained in:
parent
f0e48a09a3
commit
063558e3ac
2 changed files with 8 additions and 6 deletions
|
@ -132,13 +132,15 @@ class InternalApiController extends Controller
|
|||
|
||||
public function statusReplies(Request $request, int $id)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'limit' => 'nullable|int|min:1|max:6'
|
||||
]);
|
||||
$parent = Status::whereScope('public')->findOrFail($id);
|
||||
|
||||
$limit = $request->input('limit') ?? 3;
|
||||
$children = Status::whereInReplyToId($parent->id)
|
||||
->orderBy('created_at', 'desc')
|
||||
->take(3)
|
||||
->take($limit)
|
||||
->get();
|
||||
|
||||
$resource = new Fractal\Resource\Collection($children, new StatusTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue