AdvertRepositoryEloquent::model()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of ibrand/advert.
5
 *
6
 * (c) iBrand <https://www.ibrand.cc>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace iBrand\Component\Advert\Repositories\Eloquent;
13
14
use iBrand\Component\Advert\Models\Advert;
15
use iBrand\Component\Advert\Repositories\AdvertRepository;
16
use Prettus\Repository\Eloquent\BaseRepository;
17
use Prettus\Repository\Traits\CacheableRepository;
18
19
class AdvertRepositoryEloquent extends BaseRepository implements AdvertRepository
20
{
21
    use CacheableRepository;
22
23
    /**
24
     * Specify Model class name.
25
     *
26
     * @return string
27
     */
28 4
    public function model()
29
    {
30 4
        return Advert::class;
31
    }
32
33
    /**
34
     * get advert by code.
35
     *
36
     * @param $code
37
     *
38
     * @return mixed
39
     */
40 2
    public function getByCode($code,$status=1)
41
    {
42 2
        return $this->findByField('code', $code)->where('status',$status)->first();
43
    }
44
}
45