Completed
Push — api/develop ( ceb0fc...52cb6e )
by Bertrand
25:03
created

Repository::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the HRis Software package.
5
 *
6
 * HRis - Human Resource and Payroll System
7
 *
8
 * @link http://github.com/HB-Co/HRis
9
 */
10
namespace HRis\Api\Repositories;
11
12
class Repository implements RepositoryInterface
13
{
14
    /**
15
     * Eloquent model.
16
     *
17
     * @var \Illuminate\Database\Eloquent\Model
18
     */
19
    protected $model;
20
21
    /**
22
     * Repository constructor.
23
     *
24
     * @param \Illuminate\Database\Eloquent\Model $model
25
     *
26
     * @author Harlequin Doyon
27
     */
28
    public function __construct($model)
29
    {
30
        $this->model = $model;
31
    }
32
33
    /**
34
     * Get all records.
35
     *
36
     * @return \Illuminate\Database\Eloquent\Collection|static[]
37
     *
38
     * @author Harlequin Doyon
39
     */
40
    public function all()
41
    {
42
        return $this->model->all();
43
    }
44
45
    /**
46
     * Find a certain record.
47
     *
48
     * @param int $id
49
     *
50
     * @return \Illuminate\Database\Eloquent\Model
51
     *
52
     * @author Harlequin Doyon
53
     */
54
    public function find($id)
55
    {
56
        return $this->model->findOrFail($id);
57
    }
58
}
59