aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/Posts/Services/PostService.php
diff options
context:
space:
mode:
authorMarvin Borner2018-08-28 16:05:01 +0200
committerMarvin Borner2018-08-28 16:05:01 +0200
commit781438fc4cd54c885e52af22e1dc0ccaaace015e (patch)
tree3cdbf2e2a6df6e0a321084dbc1c3d7370f0eb498 /api/Posts/Services/PostService.php
parent113dfd2bc5089c66b7ff5d1ddccbd8c895bdd766 (diff)
Finished api of getting posts
Diffstat (limited to 'api/Posts/Services/PostService.php')
-rw-r--r--api/Posts/Services/PostService.php14
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();