StockController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 1
cbo 4
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A dashboard() 0 8 1
1
<?php namespace App\Http\Controllers;
2
3
use App\Models\Categories;
4
use App\Repositories\CategoryRepository;
5
use App\Repositories\SettingRepository;
6
7
class StockController extends Controller {
8
9
    private $settingRepository;
10
    private $categoryRepository;
11
12
    public function __construct(SettingRepository $settingRepository, CategoryRepository $categoryRepository)
13
    {
14
        $this->settingRepository = $settingRepository;
15
        $this->categoryRepository = $categoryRepository;
16
    }
17
18
    public function dashboard()
19
    {
20
        $categories = $this->categoryRepository->allAPI();
21
        $stockEmptyAlert = intval( $this->settingRepository->getValue(SettingRepository::STOCK_EMPTY_ALERT) );
22
23
        return view('stock.app')->with('categories', $categories)
24
                                ->with('stockEmptyAlert', $stockEmptyAlert);
25
    }
26
27
}
28