Passed
Push — analysis-XNGW1g ( 55039c )
by Kyle
07:59 queued 32s
created

CrudService::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
3
namespace App\Services;
4
5
trait CrudService
6
{
7
    public function index()
8
    {
9
        return $this->repository->getAll();
10
    }
11
12
    public function create(array $attributes)
13
    {
14
        return $this->repository->create($attributes);
15
    }
16
17
    public function read($id)
18
    {
19
        return $this->repository->find($id);
20
    }
21
22
    public function update(array $attributes, $id)
23
    {
24
        return $this->repository->update($id, $attributes);
25
    }
26
27
    public function delete($id)
28
    {
29
        return $this->repository->delete($id);
30
    }
31
32
    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = ['*'])
33
    {
34
        return $this->repository->getPaginate($perPage, $orderBy, $column);
35
    }
36
37
    public function getPaginateWithFilter(array $filters = [], int $perPage = null, bool $orderBy = true, array $column = ['*'])
38
    {
39
        return $this->repository->getPaginateWithFilter($filters, $perPage, $orderBy, $column);
40
    }
41
42
    public function getAllWithFilter(array $filters = [], bool $orderBy = true, array $column = ['*'])
43
    {
44
        return $this->repository->getAllWithFilter($filters, $orderBy, $column);
45
    }
46
}
47