First round of API additions

This commit is contained in:
Dane Everitt 2017-11-19 16:30:00 -06:00
parent bf9708fe4f
commit 698c121e11
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 229 additions and 142 deletions

View file

@ -184,14 +184,20 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf
/**
* {@inheritdoc}
*/
public function all()
public function all($paginate = null)
{
Assert::nullOrIntegerish($paginate, 'First argument passed to all must be null or integer, received %s.');
$instance = $this->getBuilder();
if (is_subclass_of(get_called_class(), SearchableInterface::class)) {
$instance = $instance->search($this->searchTerm);
}
return $instance->get($this->getColumns());
if (is_null($paginate)) {
return $instance->get($this->getColumns());
}
return $instance->paginate($paginate, $this->getColumns());
}
/**