Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ConversionController | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
deleteConversion | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
deleteConversionNote | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | namespace App\Http\Controllers\api\Root; |
3 | |
4 | use App\Http\Controllers\api\BaseController as BaseController; |
5 | |
6 | use App\Http\Controllers\Controller; |
7 | use Illuminate\Http\Request; |
8 | use Illuminate\Http\JsonResponse; |
9 | |
10 | use App\Models\Conversion; |
11 | use App\Models\ConversionNote; |
12 | use App\Models\ConversionDigest; |
13 | use App\Models\ConversionStatus; |
14 | use App\Models\ConversionTransaction; |
15 | |
16 | class ConversionController extends BaseController |
17 | { |
18 | |
19 | public function deleteConversion(Int $id, Request $request):JsonResponse |
20 | { |
21 | /** |
22 | * Get conversion |
23 | */ |
24 | $conversion = Conversion::find($id); |
25 | |
26 | /** |
27 | * No record |
28 | * HTTP 404 |
29 | */ |
30 | if (is_null($conversion)) { |
31 | return $this->sendError(404, null, null); |
32 | } |
33 | |
34 | /** |
35 | * Delete conversion |
36 | */ |
37 | $conversion->delete(); |
38 | |
39 | /** |
40 | * HTTP 201 |
41 | */ |
42 | return $this->sendResponse(201, null); |
43 | |
44 | } // deleteConversion |
45 | |
46 | |
47 | /** |
48 | * Delete one note by it's id |
49 | * |
50 | * @author gbh |
51 | * @note root only |
52 | * @see http://swagger.humanverify.test/#get-/api/root/conversions/notes/-id- |
53 | */ |
54 | public function deleteConversionNote(Int $id, Request $request):JsonResponse |
55 | { |
56 | /** |
57 | * Get conversion note |
58 | */ |
59 | $note = ConversionNote::find($id); |
60 | |
61 | /** |
62 | * No record |
63 | * HTTP 404 |
64 | */ |
65 | if (is_null($note)) { |
66 | return $this->sendError(404, null, null); |
67 | } |
68 | |
69 | /** |
70 | * Delete note |
71 | */ |
72 | $note->delete(); |
73 | |
74 | /** |
75 | * HTTP 201 |
76 | */ |
77 | return $this->sendResponse(201, null); |
78 | } // deleteConversionNote |
79 | } |