CurrencyController   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
eloc 17
c 1
b 0
f 1
dl 0
loc 44
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 5 1
A destroy() 0 7 1
A store() 0 7 1
A create() 0 3 1
A edit() 0 3 1
A update() 0 7 1
1
<?php
2
3
namespace Turahe\Master\Http\Controllers;
4
5
use Illuminate\Http\RedirectResponse;
6
use Illuminate\Routing\Controller;
7
use Illuminate\View\View;
8
use Turahe\Master\Http\Requests\Currency\CurrencyStoreRequest;
9
use Turahe\Master\Http\Requests\Currency\CurrencyUpdateRequest;
10
use Turahe\Master\Models\Currency;
11
12
class CurrencyController extends Controller
13
{
14
    public function index(): View
15
    {
16
        $currencies = Currency::all();
17
18
        return view('master::currencies.index', compact('currencies'));
19
    }
20
21
    public function create(): View
22
    {
23
        return view('master::currencies.create');
24
    }
25
26
    public function store(CurrencyStoreRequest $request): RedirectResponse
27
    {
28
        Currency::create($request->all());
29
30
        return redirect()
31
            ->route('currencies.index')
32
            ->with('success', 'Color was saved');
33
    }
34
35
    public function edit(Currency $currency)
0 ignored issues
show
Unused Code introduced by
The parameter $currency is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function edit(/** @scrutinizer ignore-unused */ Currency $currency)

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

Loading history...
36
    {
37
        return view('master::currencies.create', compact('Color'));
38
    }
39
40
    public function update(CurrencyUpdateRequest $request, Currency $currency): RedirectResponse
41
    {
42
        $currency->update($request->all());
43
44
        return redirect()
45
            ->route('currencies.index')
46
            ->with('success', 'Color was update');
47
    }
48
49
    public function destroy(Currency $currency)
50
    {
51
        $currency->delete();
52
53
        return redirect()
54
            ->route('master::currencies.index')
55
            ->with('success', 'Currency deleted');
56
    }
57
}
58