Skip to content

Commit 9606072

Browse files
committed
Cleanup Base Repository from unused methods
1 parent 654dfbc commit 9606072

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

src/Repositories/Repository.php

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
namespace PPSpaces\Repositories;
44

55
use ReflectionClass;
6-
use JsonSerializable;
76

87
use Illuminate\Container\Container as App;
98

109
use Illuminate\Database\Eloquent\Model;
1110
use Illuminate\Contracts\Routing\UrlRoutable;
1211

1312
use PPSpaces\Exceptions\RepositoryException;
13+
use PPSpaces\Repositories\RepositoryCollection;
1414
use PPSpaces\Contracts\Repository as RepositoryContract;
1515

16-
abstract class Repository implements RepositoryContract, JsonSerializable, UrlRoutable {
16+
abstract class Repository implements RepositoryContract, UrlRoutable
17+
{
1718

1819
/**
1920
* The application instance being facaded.
@@ -68,7 +69,7 @@ public function __construct(App $app) {
6869
* @param \Illuminate\Database\Query\Builder $query
6970
* @return void
7071
*/
71-
public function before($query) {}
72+
abstract public function before($query);
7273

7374
/**
7475
* Get all of the models from the database.
@@ -138,17 +139,15 @@ public function delete($id) {
138139
* @param \Illuminate\Support\Collection|array|int $ids
139140
* @return int
140141
*/
141-
public static function destroy($ids) {
142-
//
143-
}
142+
abstract static function destroy($ids);
144143

145144
/**
146145
* Specify Model class name
147146
*
148147
* @return string
149148
*/
150149
public function model() {
151-
return $this->model;
150+
return $this->resolved;
152151
}
153152

154153
/**
@@ -205,33 +204,17 @@ public function resolveRouteBinding($value)
205204
return $this;
206205
}
207206

208-
/**
209-
* Convert the object into something JSON serializable.
210-
*
211-
* @return array
212-
*/
213-
public function jsonSerialize()
214-
{
215-
return $this->resolved->toArray();
216-
}
217-
218-
/**
219-
* Convert the model instance to an array.
220-
*
221-
* @return array
222-
*/
223-
public function toArray()
224-
{
225-
return $this->resolved->toArray();
226-
}
227-
228207
/**
229208
* Convert the model to its string representation.
230209
*
231210
* @return string
232211
*/
233212
public function __toString()
234213
{
235-
return $this->resolved->toJson();
214+
if (isset($this->resolved)) {
215+
return $this->resolved->toJson();
216+
}
217+
218+
return null;
236219
}
237220
}

0 commit comments

Comments
 (0)