Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Update RepositoryProvider.php #96

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/Bosnadev/Repositories/Eloquent/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function with(array $relations)
public function lists($value, $key = null)
{
$this->applyCriteria();
$lists = $this->model->lists($value, $key);
$lists = $this->model->pluck($value, $key);
if (is_array($lists)) {
return $lists;
}
Expand Down Expand Up @@ -244,7 +244,28 @@ public function findWhere($where, $columns = ['*'], $or = false)
return $model->get($columns);
}

/**
* @param $attribute
* @param array $values
* @param $columns
* @return mixed
*/
public function whereIn($attribute, array $values, $columns = ['*'])
{
$this->applyCriteria();
return $this->model->whereIn($attribute, $values)->get($columns);
}

/**
* Returns clean entity of model
* @return \Illuminate\Database\Eloquent\Model
*/
public function entity()
{
return $this->newModel;
}

/**
* @return \Illuminate\Database\Eloquent\Builder
* @throws RepositoryException
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Bosnadev/Repositories/Providers/RepositoryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RepositoryProvider extends ServiceProvider
public function boot()
{
// Config path.
$config_path = __DIR__ . '/../../../config/repositories.php';
$config_path = __DIR__ . '/../../../../config/repositories.php';

// Publish config.
$this->publishes(
Expand Down Expand Up @@ -104,7 +104,7 @@ protected function registerBindings()
protected function registerMakeRepositoryCommand()
{
// Make repository command.
$this->app['command.repository.make'] = $this->app->share(
$this->app->singleton('command.repository.make',
function($app)
{
return new MakeRepositoryCommand($app['RepositoryCreator'], $app['Composer']);
Expand All @@ -118,7 +118,7 @@ function($app)
protected function registerMakeCriteriaCommand()
{
// Make criteria command.
$this->app['command.criteria.make'] = $this->app->share(
$this->app->singleton('command.criteria.make',
function($app)
{
return new MakeCriteriaCommand($app['CriteriaCreator'], $app['Composer']);
Expand Down