Completed
Branch feature/job-plans (e266db)
by Adam
05:31
created

PlanRepository::getDefaultId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Coyote\Repositories\Eloquent;
4
5
use Coyote\Plan;
6
use Coyote\Repositories\Contracts\PlanRepositoryInterface;
7
8
class PlanRepository extends Repository implements PlanRepositoryInterface
9
{
10
    /**
11
     * @return string
12
     */
13
    public function model()
14
    {
15
        return Plan::class;
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function getDefaultId(): int
22
    {
23
        return (int) $this->model->select('id')->where('is_default', 1)->value('id');
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function active()
30
    {
31
        return $this->model->where('is_active', 1)->orderBy('price')->get();
32
    }
33
}
34