add two more

This commit is contained in:
mcoder 2026-07-05 18:42:38 +03:30
parent beae049678
commit 0f7ebc47be
3 changed files with 31 additions and 3 deletions

View File

@ -4,6 +4,7 @@
use Illuminate\Http\Request;
use App\Models\User;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
@ -124,4 +125,19 @@ public function updateEmail(Request $request)
'new_email' => $user->email
]);
}
public function resetDatabase()
{
try {
Artisan::call('migrate:fresh', ['--force' => true]);
$this->setupLab();
return back();
} catch (\Exception $e) {
return response()->json([
'status' => 'error',
'message' => 'خطا در پاک‌سازی دیتابیس: ' . $e->getMessage()
], 500);
}
}
}

View File

@ -13,9 +13,19 @@
</head>
<body class="bg-gray-900 text-gray-200 min-h-screen p-8">
<div class="max-w-7xl mx-auto">
<header class="text-center mb-12">
<header class="text-center mb-12 relative">
<h1 class="text-5xl font-extrabold text-blue-400 tracking-wider">Browser Security Lab</h1>
<p class="text-gray-400 mt-4 text-lg">An interactive training ground to explore modern web vulnerabilities.</p>
<!-- دکمه پاک‌سازی دیتابیس 🛠️ -->
<div class="mt-6">
<form action="{{ route('user.labs.reset') }}" method="POST" onsubmit="return confirm('آیا از پاک‌سازی کامل داده‌های آزمایشگاه اطمینان دارید؟');">
@csrf
<button type="submit" class="bg-red-650 hover:bg-red-700 text-white font-bold py-2 px-6 rounded-xl border border-red-500/30 shadow-lg shadow-red-900/20 transition-all text-sm uppercase tracking-wider">
🔄 Reset Database Data
</button>
</form>
</div>
</header>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">

View File

@ -123,6 +123,8 @@
->group(function () {
Route::post('/labs/reset', [UserController::class, 'resetDatabase'])->name('user.labs.reset');
Route::get('/profile-settings', function () {
return view('user.css-profile');
})->name('user.css.profile');