PHP Class App\Repositories\AbstractEloquentRepository

Inheritance: implements App\Repositories\RepositoryInterface
Show file Open project: ngmy/webloyer

Protected Properties

Property Type Description
$model

Public Methods

Method Description
all ( ) : Illuminate\Database\Eloquent\Collection Get all models.
byId ( integer $id ) : Model Get a model by id.
byPage ( integer $page = 1, integer $limit = 10 ) : Illuminate\Pagination\LengthAwarePaginator Get paginated models.
create ( array $data ) : Model Create a new model.
delete ( integer $id ) : boolean Delete an existing model.
update ( array $data ) : boolean Update an existing model.

Method Details

all() public method

Get all models.
public all ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

byId() public method

Get a model by id.
public byId ( integer $id ) : Model
$id integer Model id
return Illuminate\Database\Eloquent\Model

byPage() public method

Get paginated models.
public byPage ( integer $page = 1, integer $limit = 10 ) : Illuminate\Pagination\LengthAwarePaginator
$page integer Page number
$limit integer Number of models per page
return Illuminate\Pagination\LengthAwarePaginator

create() public method

Create a new model.
public create ( array $data ) : Model
$data array Data to create a model
return Illuminate\Database\Eloquent\Model

delete() public method

Delete an existing model.
public delete ( integer $id ) : boolean
$id integer Model id
return boolean

update() public method

Update an existing model.
public update ( array $data ) : boolean
$data array Data to update a model
return boolean

Property Details

$model protected property

protected $model