Completed
Push — master ( ef29db...6cb927 )
by Ariel
06:10
created

Repository::getService()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 3
1
<?php
2
3
namespace Timegridio\Concierge;
4
5
use Timegridio\Concierge\Models\Business;
6
7
class Repository
8
{
9
    /**
10
     * Default lookup identificator.
11
     *
12
     * @var string
13
     */
14
    private $identificator = 'slug';
15
16
    public function getBusiness($id, $identificator = null)
17
    {
18
        $identificator = $identificator ?: $this->identificator;
19
20
        return Business::where($identificator, $id)->first();
21
    }
22
23
    public function getService($business, $id, $identificator = null)
24
    {
25
        $identificator = $identificator ?: $this->identificator;
26
27
        return $business->services()->where($identificator, $id)->first();
28
    }
29
}
30