1 | <?php namespace Modules\Blog\Repositories\Eloquent; |
||
12 | class EloquentPostRepository extends EloquentBaseRepository implements PostRepository |
||
13 | { |
||
14 | /** |
||
15 | * @param int $id |
||
16 | * @return object |
||
17 | */ |
||
18 | public function find($id) |
||
22 | |||
23 | /** |
||
24 | * @return \Illuminate\Database\Eloquent\Collection |
||
25 | */ |
||
26 | public function all() |
||
30 | |||
31 | /** |
||
32 | * Update a resource |
||
33 | * @param $post |
||
34 | * @param array $data |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function update($post, $data) |
||
47 | |||
48 | /** |
||
49 | * Create a blog post |
||
50 | * @param array $data |
||
51 | * @return Post |
||
52 | */ |
||
53 | public function create($data) |
||
63 | |||
64 | /** |
||
65 | * Return all resources in the given language |
||
66 | * |
||
67 | * @param string $lang |
||
68 | * @return \Illuminate\Database\Eloquent\Collection |
||
69 | */ |
||
70 | public function allTranslatedIn($lang) |
||
77 | |||
78 | /** |
||
79 | * Return the latest x blog posts |
||
80 | * @param int $amount |
||
81 | * @return Collection |
||
82 | */ |
||
83 | public function latest($amount = 5) |
||
87 | |||
88 | /** |
||
89 | * Get the previous post of the given post |
||
90 | * @param object $post |
||
91 | * @return object |
||
92 | */ |
||
93 | public function getPreviousOf($post) |
||
98 | |||
99 | /** |
||
100 | * Get the next post of the given post |
||
101 | * @param object $post |
||
102 | * @return object |
||
103 | */ |
||
104 | public function getNextOf($post) |
||
109 | |||
110 | /** |
||
111 | * Find a resource by the given slug |
||
112 | * |
||
113 | * @param string $slug |
||
114 | * @return object |
||
115 | */ |
||
116 | public function findBySlug($slug) |
||
122 | } |
||
123 |