From 781438fc4cd54c885e52af22e1dc0ccaaace015e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 28 Aug 2018 16:05:01 +0200 Subject: Finished api of getting posts --- api/Posts/Services/PostService.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'api/Posts/Services/PostService.php') diff --git a/api/Posts/Services/PostService.php b/api/Posts/Services/PostService.php index 7fc5dbb..a4af3cf 100644 --- a/api/Posts/Services/PostService.php +++ b/api/Posts/Services/PostService.php @@ -2,15 +2,15 @@ namespace Api\Posts\Services; -use Exception; -use Illuminate\Auth\AuthManager; -use Illuminate\Database\DatabaseManager; -use Illuminate\Events\Dispatcher; -use Api\Posts\Exceptions\PostNotFoundException; 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; +use Illuminate\Events\Dispatcher; class PostService { @@ -36,7 +36,7 @@ class PostService public function getAll($options = []) { - return $this->postRepository->get($options); + return Post::with('post_type')->with('user')->get(); } public function getById($postId, array $options = []) @@ -77,7 +77,7 @@ class PostService private function getRequestedPost($postId) { - $post = $this->postRepository->getById($postId); + $post = Post::with('post_type')->with('user')->where('id', $postId)->get(); if (is_null($post)) { throw new PostNotFoundException(); -- cgit v1.2.3