PHP Class App\Data\Repositories\Repository

Show file Open project: Vinelab/lucid

Protected Properties

Property Type Description
$model Illuminate\Database\Eloquent\Model The model instance.

Public Methods

Method Description
__call ( string $method, array $arguments ) : mixed Implement a convenience call to findBy which allows finding by an attribute name as follows: findByName or findByAlias.
__construct ( $model )
all ( ) : Illuminate\Database\Eloquent\Collection Returns all the records.
count ( ) : integer Returns the count of all the records.
fill ( array $attributes ) : Model Fills out an instance of the model with $attributes.
fillAndSave ( array $attributes ) : Model Fills out an instance of the model and saves it, pretty much like mass assignment.
find ( string $id, array $relations = null ) : Model Find a record by its identifier.
findBy ( string $attribute, string $value, array $relations = null ) : Model Find a record by an attribute.
first ( ) : Model Returns the first record in the database.
getByAttributes ( array $attributes, string $operator = 'AND', array $relations = null ) : Collection Get all records by an associative array of attributes.
page ( $limit = 10, integer $offset, array $relations = [], $orderBy = 'updated_at', $sorting = 'desc' ) : Illuminate\Database\Eloquent\Collection Returns a range of records bounded by pagination parameters.
remove ( string $key ) : boolean Remove a selected record.

Method Details

__call() public method

Implement a convenience call to findBy which allows finding by an attribute name as follows: findByName or findByAlias.
public __call ( string $method, array $arguments ) : mixed
$method string
$arguments array
return mixed

__construct() public method

public __construct ( $model )

all() public method

Returns all the records.
public all ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

count() public method

Returns the count of all the records.
public count ( ) : integer
return integer

fill() public method

Fills out an instance of the model with $attributes.
public fill ( array $attributes ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model

fillAndSave() public method

Fills out an instance of the model and saves it, pretty much like mass assignment.
public fillAndSave ( array $attributes ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model

find() public method

Find a record by its identifier.
public find ( string $id, array $relations = null ) : Model
$id string
$relations array
return Illuminate\Database\Eloquent\Model

findBy() public method

Fails if no model is found.
public findBy ( string $attribute, string $value, array $relations = null ) : Model
$attribute string
$value string
$relations array
return Illuminate\Database\Eloquent\Model

first() public method

Returns the first record in the database.
public first ( ) : Model
return Illuminate\Database\Eloquent\Model

getByAttributes() public method

Two operators values are handled: AND | OR.
public getByAttributes ( array $attributes, string $operator = 'AND', array $relations = null ) : Collection
$attributes array
$operator string
$relations array
return Illuminate\Support\Collection

page() public method

Returns a range of records bounded by pagination parameters.
public page ( $limit = 10, integer $offset, array $relations = [], $orderBy = 'updated_at', $sorting = 'desc' ) : Illuminate\Database\Eloquent\Collection
$offset integer
$relations array
return Illuminate\Database\Eloquent\Collection

remove() public method

Remove a selected record.
public remove ( string $key ) : boolean
$key string
return boolean

Property Details

$model protected property

The model instance.
protected Model,Illuminate\Database\Eloquent $model
return Illuminate\Database\Eloquent\Model