ProvincesRepositoryEloquent   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getProvinceByRegion() 0 4 1
A getModel() 0 6 1
1
<?php
2
3
namespace Yajra\Address\Repositories\Provinces;
4
5
use Yajra\Address\Entities\Province;
6
use Yajra\Address\Repositories\EloquentBaseRepository;
7
8
class ProvincesRepositoryEloquent extends EloquentBaseRepository implements ProvincesRepository
9
{
10
    /**
11
     * Get province by region ID.
12
     *
13
     * @param int $regionId
14
     * @return \Illuminate\Database\Eloquent\Collection
15
     */
16
    public function getProvinceByRegion($regionId)
17
    {
18
        return $this->getModel()->newQuery()->where('region_id', $regionId)->orderBy('name', 'asc')->get();
0 ignored issues
show
Bug introduced by
The method orderBy() does not exist on Illuminate\Database\Eloquent\Builder. Did you maybe mean enforceOrderBy()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
19
    }
20
21
    /**
22
     * Get repository model.
23
     *
24
     * @return \Illuminate\Database\Eloquent\Model
25
     */
26
    public function getModel()
27
    {
28
        $model = config('address.models.province', Province::class);
29
30
        return new $model;
31
    }
32
}
33