PHP Class Bosnadev\Repositories\Eloquent\Repository

Inheritance: implements Bosnadev\Repositories\Contracts\RepositoryInterface, implements Bosnadev\Repositories\Contracts\CriteriaInterface
Show file Open project: bosnadev/repositories Class Usage Examples

Protected Properties

Property Type Description
$criteria Illuminate\Support\Collection
$model
$newModel
$preventCriteriaOverwriting boolean Prevents from overwriting same criteria in chain usage
$skipCriteria boolean

Public Methods

Method Description
__construct ( Illuminate\Container\Container $app, Collection $collection )
all ( array $columns = ['*'] ) : mixed
applyCriteria ( )
create ( array $data ) : mixed
delete ( $id ) : mixed
find ( $id, array $columns = ['*'] ) : mixed
findAllBy ( $attribute, $value, array $columns = ['*'] ) : mixed
findBy ( $attribute, $value, array $columns = ['*'] ) : mixed
findWhere ( array $where, array $columns = ['*'], boolean $or = false ) : Illuminate\Database\Eloquent\Collection | null Find a collection of models by the given query conditions.
getByCriteria ( Criteria $criteria )
getCriteria ( ) : mixed
lists ( string $value, string $key = null ) : array
makeModel ( ) : Builder
model ( ) : mixed Specify Model class name
paginate ( integer $perPage = 25, array $columns = ['*'] ) : mixed
pushCriteria ( Criteria $criteria )
resetScope ( )
saveModel ( array $data ) : boolean save a model without massive assignment
setModel ( $eloquentModel ) : Model Set Eloquent Model to instantiate
skipCriteria ( boolean $status = true )
update ( array $data, $id, string $attribute = "id" ) : mixed
updateRich ( array $data, $id ) : mixed
with ( array $relations )

Method Details

__construct() public method

public __construct ( Illuminate\Container\Container $app, Collection $collection )
$app Illuminate\Container\Container
$collection Illuminate\Support\Collection

all() public method

public all ( array $columns = ['*'] ) : mixed
$columns array
return mixed

applyCriteria() public method

public applyCriteria ( )

create() public method

public create ( array $data ) : mixed
$data array
return mixed

delete() public method

public delete ( $id ) : mixed
$id
return mixed

find() public method

public find ( $id, array $columns = ['*'] ) : mixed
$id
$columns array
return mixed

findAllBy() public method

public findAllBy ( $attribute, $value, array $columns = ['*'] ) : mixed
$attribute
$value
$columns array
return mixed

findBy() public method

public findBy ( $attribute, $value, array $columns = ['*'] ) : mixed
$attribute
$value
$columns array
return mixed

findWhere() public method

Find a collection of models by the given query conditions.
public findWhere ( array $where, array $columns = ['*'], boolean $or = false ) : Illuminate\Database\Eloquent\Collection | null
$where array
$columns array
$or boolean
return Illuminate\Database\Eloquent\Collection | null

getByCriteria() public method

public getByCriteria ( Criteria $criteria )
$criteria Bosnadev\Repositories\Criteria\Criteria

getCriteria() public method

public getCriteria ( ) : mixed
return mixed

lists() public method

public lists ( string $value, string $key = null ) : array
$value string
$key string
return array

makeModel() public method

public makeModel ( ) : Builder
return Illuminate\Database\Eloquent\Builder

model() abstract public method

Specify Model class name
abstract public model ( ) : mixed
return mixed

paginate() public method

public paginate ( integer $perPage = 25, array $columns = ['*'] ) : mixed
$perPage integer
$columns array
return mixed

pushCriteria() public method

public pushCriteria ( Criteria $criteria )
$criteria Bosnadev\Repositories\Criteria\Criteria

resetScope() public method

public resetScope ( )

saveModel() public method

save a model without massive assignment
public saveModel ( array $data ) : boolean
$data array
return boolean

setModel() public method

Set Eloquent Model to instantiate
public setModel ( $eloquentModel ) : Model
$eloquentModel
return Illuminate\Database\Eloquent\Model

skipCriteria() public method

public skipCriteria ( boolean $status = true )
$status boolean

update() public method

public update ( array $data, $id, string $attribute = "id" ) : mixed
$data array
$id
$attribute string
return mixed

updateRich() public method

public updateRich ( array $data, $id ) : mixed
$data array
$id
return mixed

with() public method

public with ( array $relations )
$relations array

Property Details

$criteria protected property

protected Collection,Illuminate\Support $criteria
return Illuminate\Support\Collection

$model protected property

protected $model

$newModel protected property

protected $newModel

$preventCriteriaOverwriting protected property

Prevents from overwriting same criteria in chain usage
protected bool $preventCriteriaOverwriting
return boolean

$skipCriteria protected property

protected bool $skipCriteria
return boolean