diff options
author | Marvin Borner | 2018-08-28 16:05:01 +0200 |
---|---|---|
committer | Marvin Borner | 2018-08-28 16:05:01 +0200 |
commit | 781438fc4cd54c885e52af22e1dc0ccaaace015e (patch) | |
tree | 3cdbf2e2a6df6e0a321084dbc1c3d7370f0eb498 /api/Posts/Services/PostService.php | |
parent | 113dfd2bc5089c66b7ff5d1ddccbd8c895bdd766 (diff) |
Finished api of getting posts
Diffstat (limited to 'api/Posts/Services/PostService.php')
-rw-r--r-- | api/Posts/Services/PostService.php | 14 |
1 files changed, 7 insertions, 7 deletions
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(); |