Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Timeline\Http\Handlers;
- use App\Jobs\Entities\Jobs;
- use App\Timeline\Entities\Timeline;
- use App\Timeline\Http\Responses\TimelineIndexResponse;
- final class TimelineIndex
- {
- /**
- * @var \App\Timeline\Entities\Timeline
- */
- private $timeline;
- /**
- * TimelineIndex constructor.
- *
- * @param \App\Timeline\Entities\Timeline $timeline
- */
- public function __construct(Timeline $timeline)
- {
- $this->timeline = $timeline;
- }
- /**
- * @return \App\Timeline\Http\Responses\TimelineIndexResponse
- */
- public function __invoke(): TimelineIndexResponse
- {
- $statuses = $this->timeline
- ->with('owner')
- ->friendsAndFollowers()
- ->orderBy('timeline.created_at', 'desc')
- ->paginate(10)
- ->getCollection();
- return new TimelineIndexResponse($statuses);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment