Code Duplication    Length = 7-13 lines in 4 locations

app/Repositories/LotRepository.php 1 location

@@ 33-43 (lines=11) @@
30
            ]);
31
    }
32
33
    public function find($slug)
34
    {
35
        if (is_numeric($slug))
36
            return $this->getModel()
37
                ->whereId((int) $slug)
38
                ->first();
39
40
        return $this->getModel()
41
            ->whereSlug($slug)
42
            ->first();
43
    }
44
45
    public function statusChange(){
46

app/Repositories/ModelColorsRepository.php 1 location

@@ 41-51 (lines=11) @@
38
        return $color;
39
    }
40
41
    public function find($slug)
42
    {
43
        if (is_numeric($slug))
44
            return $this->getModel()
45
                ->whereId((int) $slug)
46
                ->first();
47
48
        return $this->getModel()
49
            ->whereSlug($slug)
50
            ->first();
51
    }
52
    
53
    public function findKey($key)
54
    {

app/Repositories/ProductsRepository.php 1 location

@@ 41-53 (lines=13) @@
38
     * @param $slug
39
     * @return Product
40
     */
41
    public function find($slug)
42
    {
43
        if (is_numeric($slug))
44
            return $this->getModel()
45
                ->whereId((int) $slug)
46
//                ->whereIn('status', ['published', 'drafted', 'notverified', 'completed'])
47
                ->first();
48
49
        return $this->getModel()
50
            ->whereSlug($slug)
51
//            ->whereIn('status', ['published', 'drafted', 'notverified', 'completed'])
52
            ->first();
53
    }
54
55
    /**
56
     * Create product.

app/Repositories/Repository.php 1 location

@@ 26-32 (lines=7) @@
23
     * @param $slug
24
     * @return Model
25
     */
26
    public function find($slug)
27
    {
28
        if (is_numeric($slug))
29
            return $this->getModel()->active()->whereId((int) $slug)->first();
30
31
        return $this->getModel()->active()->whereSlug($slug)->first();
32
    }
33
34
    /**
35
     * Lists the columns.