Remove softDelete on 2FAccounts

This commit is contained in:
Bubka
2020-01-07 16:46:50 +01:00
parent eab03e6d0c
commit 3a0bf1a596
5 changed files with 8 additions and 35 deletions

View File

@ -7,6 +7,7 @@ use OTPHP\TOTP;
use OTPHP\Factory;
use Illuminate\Http\Request;
use ParagonIE\ConstantTime\Base32;
use Illuminate\Support\Facades\Storage;
class TwoFAccountController extends Controller
{
@ -106,24 +107,16 @@ class TwoFAccountController extends Controller
*/
public function destroy(TwoFAccount $twofaccount)
{
// delete icon
$storedIcon = 'public/' . pathinfo($twofaccount->icon)['basename'];
if( Storage::exists($storedIcon) ) {
Storage::delete($storedIcon);
}
$twofaccount->delete();
return response()->json(null, 204);
}
/**
* Remove the specified soft deleted resource from storage.
*
* @param \App\TwoFAccount $twofaccount
* @return \Illuminate\Http\Response
*/
public function forceDestroy($id)
{
$twofaccount = TwoFAccount::onlyTrashed()->findOrFail($id);
$twofaccount->forceDelete();
return response()->json(null, 204);
}
}