1 | <?php |
||
17 | class EloquentPostRepository extends EloquentBaseRepository implements PostRepository |
||
18 | { |
||
19 | /** |
||
20 | * @param int $id |
||
21 | * @return object |
||
22 | */ |
||
23 | public function find($id) |
||
27 | |||
28 | /** |
||
29 | * @return \Illuminate\Database\Eloquent\Collection |
||
30 | */ |
||
31 | public function all() |
||
35 | |||
36 | /** |
||
37 | * Update a resource |
||
38 | * @param $post |
||
39 | * @param array $data |
||
40 | * @return mixed |
||
41 | */ |
||
42 | 3 | public function update($post, $data) |
|
53 | |||
54 | /** |
||
55 | * Create a blog post |
||
56 | * @param array $data |
||
57 | * @return Post |
||
58 | */ |
||
59 | 9 | public function create($data) |
|
70 | |||
71 | public function destroy($model) |
||
77 | |||
78 | /** |
||
79 | * Return all resources in the given language |
||
80 | * |
||
81 | * @param string $lang |
||
82 | * @return \Illuminate\Database\Eloquent\Collection |
||
83 | */ |
||
84 | 1 | public function allTranslatedIn($lang) |
|
91 | |||
92 | /** |
||
93 | * Return the latest x blog posts |
||
94 | * @param int $amount |
||
95 | * @return Collection |
||
96 | */ |
||
97 | public function latest($amount = 5) |
||
101 | |||
102 | /** |
||
103 | * Get the previous post of the given post |
||
104 | * @param object $post |
||
105 | * @return object |
||
106 | */ |
||
107 | public function getPreviousOf($post) |
||
112 | |||
113 | /** |
||
114 | * Get the next post of the given post |
||
115 | * @param object $post |
||
116 | * @return object |
||
117 | */ |
||
118 | public function getNextOf($post) |
||
123 | |||
124 | /** |
||
125 | * Find a resource by the given slug |
||
126 | * |
||
127 | * @param string $slug |
||
128 | * @return object |
||
129 | */ |
||
130 | public function findBySlug($slug) |
||
136 | } |
||
137 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: