From e30618dd397dea1ca295feef537e01f97996e71c Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 30 Aug 2018 17:40:19 +0200 Subject: Finished/optimized getting of posts --- api/Posts/Services/PostService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'api/Posts/Services') diff --git a/api/Posts/Services/PostService.php b/api/Posts/Services/PostService.php index 812f638..0232af2 100644 --- a/api/Posts/Services/PostService.php +++ b/api/Posts/Services/PostService.php @@ -6,7 +6,6 @@ use Api\Posts\Events\PostWasCreated; use Api\Posts\Events\PostWasDeleted; use Api\Posts\Events\PostWasUpdated; use Api\Posts\Exceptions\PostNotFoundException; -use Api\Posts\Models\Post; use Api\Posts\Repositories\PostRepository; use Illuminate\Auth\AuthManager; use Illuminate\Database\DatabaseManager; @@ -36,7 +35,7 @@ class PostService public function getAll($options = []) { - return $this->postRepository->get($options); + return $this->postRepository->getJoined($options); } public function getById($postId, array $options = []) @@ -77,7 +76,7 @@ class PostService private function getRequestedPost($postId) { - $post = Post::with('post_type')->with('user')->where('id', $postId)->get(); + $post = $this->postRepository->getJoinedById($postId); if (is_null($post)) { throw new PostNotFoundException(); -- cgit v1.2.3