Issues (52)

src/Http/Controllers/CurrencyController.php (1 issue)

Severity
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
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