1. Go to this page and download the library: Download tgalfa/reposervice library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function getModel();
public function get(array $columns = ['*'], array $scopes = []]);
public function paginate(
int $perPage,
array $columns = ['*'],
array $scopes = []
);
public function getById(int $id, array $columns = ['*']);
public function store(array $data, array $scopes = []);
public function update(Model $model, array $data, array $scopes = []);
public function updateOrCreate(array $attributes, array $data, array $scopes = []);
public function delete(Model $model);
public function scopeIsActive(Builder $query)
{
return $query->where('active', 1);
}
public function scopeByCategory(Builder $query, int $categoryId)
{
return $query->where('category_id', $categoryId);
}
public function getModel();
public function get(
array $columns = ['*'],
array $scopes = [],
int $perPage = null
);
public function paginate(
int $perPage,
array $columns = ['*'],
array $scopes = []
);
public function getById(int $id, array $columns = ['*']);
public function store(array $data);
public function update(Model $model, array $data);
public function updateOrCreate(array $attributes, array $data);
public function delete(Model $model);