/**
  * @api            {get} /posts Get Latest Submission Posts
  * @apiGroup       Task Posts
  * @apiDescription Returns a number of featured posts to display on the home page.
  *
  * TODO: Route should be cached. (By CloudFlare preferably)
  *
  * @return Response
  */
 public function index()
 {
     $submissions = Submission::approved()->orderBy('approvedAt')->take(10)->with(['post.task'])->get();
     // Extract the posts from the submissions
     $posts = [];
     foreach ($submissions as $submission) {
         $posts[] = $submission->post;
     }
     return $this->response(['posts' => $posts]);
 }
 /**
  * @api            {get} /submissions Get Latest Submissions
  * @apiGroup       Task Submissions
  * @apiDescription Returns a list of the latest 10 approved task submissions.
  *
  * @return Response
  */
 public function index()
 {
     $submissions = Submission::approved()->orderBy('approvedAt')->take(10)->with('post')->get();
     return $this->response(['submissions' => $submissions]);
 }