Completed
Push — development ( b0c738...8cbb83 )
by Kyle
03:47
created

BaseCrudServices::read()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace App\Services\Production;
3
4
use App\Services\BaseCrudServicesInterface;
5
6
abstract class BaseCrudServices implements BaseCrudServicesInterface
7
{
8
9
    /**
10
     * @var \App\Repositories\BaseRepositoryInterface
11
     */
12
    protected $repository;
13
14
    public function index()
15
    {
16
        return $this->repository->getAll();
17
    }
18
19
    public function create(array $attributes)
20
    {
21
        return $this->repository->create($attributes);
22
    }
23
24
    public function read($id)
25
    {
26
        return $this->repository->find($id);
27
    }
28
29
    public function update(array $attributes, $id)
30
    {
31
        return $this->repository->update($id, $attributes);
32
    }
33
34
    public function delete($id)
35
    {
36
        return $this->repository->delete($id);
37
    }
38
39
    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = ['*'])
40
    {
41
        return $this->repository->getPaginate($perPage, $orderBy, $column);
42
    }
43
44
    public function getPaginateWithFilter(
45
        array $filters = [],
46
        int $perPage = null,
47
        bool $orderBy = true,
48
        array $column = ['*']
49
    ) {
50
        return $this->repository->getPaginateWithFilter($filters, $perPage, $orderBy, $column);
51
    }
52
53
    public function getAllWithFilter(
54
        array $filters = [],
55
        bool $orderBy = true,
56
        array $column = ['*']
57
    ) {
58
        return $this->repository->getAllWithFilter($filters, $orderBy, $column);
59
    }
60
}
61