Fixed SQLSTATE[23000]: Integrity constraint violation: 19 CHECK constraint failed when deleting user

This commit is contained in:
Julian Prieber 2022-07-11 20:46:45 +02:00
parent 5f58a1f4ad
commit ceb65f6d17
1 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Auth\Events\Registered;
use Illuminate\Support\Facades\Schema;
use Auth;
use Exception;
@ -134,8 +135,11 @@ class AdminController extends Controller
{
$id = $request->id;
$user = User::find($id);
$user = User::find($id);
Schema::disableForeignKeyConstraints();
$user->forceDelete();
Schema::enableForeignKeyConstraints();
return redirect('panel/users/all');
}