mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 16:23:18 +01:00
Remove unnecessary try|catch
This commit is contained in:
parent
5531c0e7e1
commit
c6b7c4e495
@ -58,12 +58,9 @@ public function store(Request $request)
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
try {
|
||||
$twofaccount = TwoFAccount::FindOrFail($id);
|
||||
|
||||
return response()->json($twofaccount, 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json( ['message' => 'not found' ], 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,8 +92,6 @@ public function update(Request $request, $id)
|
||||
'service' => 'required',
|
||||
]);
|
||||
|
||||
try {
|
||||
|
||||
$twofaccount = TwoFAccount::FindOrFail($id);
|
||||
|
||||
if( $twofaccount->type === 'hotp' ) {
|
||||
@ -129,12 +124,6 @@ public function update(Request $request, $id)
|
||||
return response()->json($twofaccount, 200);
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
|
||||
return response()->json( ['message' => 'not found' ] , 404);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -145,7 +134,6 @@ public function update(Request $request, $id)
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
|
||||
$twofaccount = TwoFAccount::FindOrFail($id);
|
||||
|
||||
@ -156,16 +144,10 @@ public function destroy($id)
|
||||
Storage::delete($storedIcon);
|
||||
}
|
||||
|
||||
// delete account
|
||||
$twofaccount->delete();
|
||||
|
||||
return response()->json(null, 204);
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
|
||||
return response()->json(['message' => 'already gone'], 404);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user