|
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) |
|
|
|
|
|
|
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
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.