AddLotComposer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use App\Repositories\CategoryRepository;
6
use App\Repositories\CurrenciesRepository;
7
use App\Repositories\LotRepository;
8
use Illuminate\Contracts\View\View;
9
10
class AddLotComposer extends Composer
11
{
12
    /**
13
     * @var LotRepository
14
     */
15
    protected $lots;
16
17
    /**
18
     * @var CategoryRepository
19
     */
20
    protected $categories;
21
22
    /**
23
     * @var CurrenciesRepository
24
     */
25
    protected $currencies;
26
27
    /**
28
     * AddLotComposer constructor.
29
     * @param LotRepository $lotRepository
30
     * @param CategoryRepository $categoryRepository
31
     * @param CurrenciesRepository $currenciesRepository
32
     */
33
    public function __construct(
34
        LotRepository $lotRepository,
35
        CategoryRepository $categoryRepository,
36
        CurrenciesRepository $currenciesRepository
37
    ) {
38
        $this->lots = $lotRepository;
39
        $this->categories = $categoryRepository;
40
        $this->currencies = $currenciesRepository;
41
    }
42
43
    /**
44
     * Bind view to data.
45
     * 
46
     * @param View $view
47
     * @return $this
48
     */
49
    public function compose(View $view)
50
    {
51
        $categories = $this->categories->getPublic();
52
        $currencies = $this->currencies->getPublic();
53
54
        return $view
55
            ->with('categories', $categories)
56
            ->with('currencies', $currencies);
57
    }
58
}