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

CrudService   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 40
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 3 1
A index() 0 3 1
A delete() 0 3 1
A create() 0 3 1
A update() 0 3 1
A getAllWithFilter() 0 3 1
A getPaginateWithFilter() 0 3 1
A getPaginate() 0 3 1
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