Completed
Push — master ( 91081e...20ce73 )
by Scott
02:47
created

ProductRepository::find()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 2
1
<?php namespace Bedard\Shop\Repositories;
2
3
use Bedard\Shop\Models\Product;
4
5
class ProductRepository
6
{
7
    /**
8
     * Find a product.
9
     *
10
     * @param  string   $slug
11
     * @param  array    $params
12
     * @return \Bedard\Shop\Models\Product
13
     */
14
    public function find($slug, array $params = [])
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
    {
16
        $product = Product::isEnabled()
17
            ->joinPrice()
18
            ->with([
19
                'images',
20
                'inventories.optionValues',
21
                'options.values',
22
            ])
23
            ->whereSlug($slug);
24
25
        return $product->firstOrFail();
26
    }
27
}
28