Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| SettingController | |
0.00% |
0 / 22 |
|
0.00% |
0 / 7 |
90 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| create | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| store | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| show | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| edit | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| update | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| destroy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers; |
| 4 | |
| 5 | use App\Models\Setting; |
| 6 | use App\Service\PosService; |
| 7 | use App\Traits\PosTrait; |
| 8 | use Illuminate\Http\Request; |
| 9 | use Illuminate\Http\Response; |
| 10 | |
| 11 | class SettingController extends Controller |
| 12 | { |
| 13 | use PosTrait; |
| 14 | |
| 15 | /** |
| 16 | * Display a listing of the resource. |
| 17 | * |
| 18 | * @return Response |
| 19 | */ |
| 20 | public function index() |
| 21 | { |
| 22 | $data['setting'] = Setting::query()->first(); |
| 23 | |
| 24 | return view('admin.configuration.setting')->with($data); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Show the form for creating a new resource. |
| 29 | * |
| 30 | * @return Response |
| 31 | */ |
| 32 | public function create() |
| 33 | { |
| 34 | // |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Store a newly created resource in storage. |
| 39 | * |
| 40 | * @return Response |
| 41 | */ |
| 42 | public function store(Request $request) |
| 43 | { |
| 44 | $request->validate([ |
| 45 | 'name' => 'required', |
| 46 | ]); |
| 47 | $data = $request->all(); |
| 48 | if ($request->hasFile('logo')) { |
| 49 | $data['logo'] = $this->FileProcessing($request->file('logo'), PosService::APP_LOGO); |
| 50 | } |
| 51 | Setting::query()->create($data); |
| 52 | |
| 53 | return redirect()->back()->with('success', 'Successfully Settings Added'); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Display the specified resource. |
| 58 | * |
| 59 | * @return Response |
| 60 | */ |
| 61 | public function show(Setting $setting) |
| 62 | { |
| 63 | // |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Show the form for editing the specified resource. |
| 68 | * |
| 69 | * @return Response |
| 70 | */ |
| 71 | public function edit(Setting $setting) |
| 72 | { |
| 73 | // |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Update the specified resource in storage. |
| 78 | * |
| 79 | * @return Response |
| 80 | */ |
| 81 | public function update(Request $request, Setting $setting) |
| 82 | { |
| 83 | $request->validate([ |
| 84 | 'name' => 'required', |
| 85 | ]); |
| 86 | $data = $request->all(); |
| 87 | if ($request->hasFile('logo')) { |
| 88 | $data['logo'] = $this->FileProcessing($request->file('logo'), PosService::APP_LOGO); |
| 89 | } |
| 90 | $setting->update($data); |
| 91 | |
| 92 | return redirect()->back()->with('success', 'Successfully Settings updated'); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Remove the specified resource from storage. |
| 97 | * |
| 98 | * @return Response |
| 99 | */ |
| 100 | public function destroy(Setting $setting) |
| 101 | { |
| 102 | // |
| 103 | } |
| 104 | } |