ProvincesRepositoryEloquent::getModel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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