feat: patient view, media player, and rich editor enhancements

This commit is contained in:
SajjadMahmoody
2026-04-23 21:24:36 +03:30
parent 95592aa510
commit 063b20d26f
101 changed files with 9648 additions and 117 deletions
+9 -19
View File
@@ -8,7 +8,7 @@
if (in_array($locale, config('app.available_locales', ['fa', 'en']))) {
session(['locale' => $locale]);
}
return redirect()->back();
return redirect(url()->previous('/admin'));
})->name('locale.switch');
Route::middleware(['web', 'auth'])->group(function () {
@@ -40,27 +40,17 @@
})->name('sync.run');
Route::get('/admin/backup/download', function () {
$dbPath = database_path('database.sqlite');
$zipPath = session('backup_tmp_path');
$zipName = session('backup_tmp_name', 'matab-backup.zip');
if (! file_exists($dbPath)) {
abort(404, 'Database file not found.');
if (! $zipPath || ! file_exists($zipPath)) {
abort(404, 'Backup file not found.');
}
$backupDir = storage_path('app/backups');
session()->forget(['backup_tmp_path', 'backup_tmp_name']);
if (! is_dir($backupDir)) {
mkdir($backupDir, 0755, true);
}
foreach (glob($backupDir . '/matab-backup-*.sqlite') as $oldFile) {
unlink($oldFile);
}
$filename = 'matab-backup-' . now()->format('Y-m-d_H-i-s') . '.sqlite';
$backupPath = $backupDir . '/' . $filename;
copy($dbPath, $backupPath);
return response()->json(['success' => true, 'filename' => $filename]);
return response()->download($zipPath, $zipName, [
'Content-Type' => 'application/zip',
])->deleteFileAfterSend(true);
})->name('backup.download');
});