Permalink
Browse files

PostRepository 新增 getAllPosts()

  • Loading branch information...
1 parent 6b5cb40 commit 33f673dcbde4a935e04364c4ce4d064c9371a3cc Sam.IO.Hsiao committed Jul 27, 2016
Showing with 9 additions and 0 deletions.
  1. +9 −0 app/Repositories/PostRepository.php
@@ -5,6 +5,7 @@
namespace App\Repositories;
use App\Post;
+use Illuminate\Database\Eloquent\Collection;
class PostRepository
{
@@ -20,4 +21,12 @@ public function getTitle(int $id, string $default) : string
->first(null, new Post(['title' => $default]))
->title;
}
+
+ /**
+ * @return Collection|Post[]
+ */
+ public function getAllPosts() : Collection
+ {
+ return Post::all();
+ }
}

0 comments on commit 33f673d

Please sign in to comment.