Raffales-LMS/routes/web.php

120 lines
5.0 KiB
PHP
Raw Permalink Normal View History

2024-04-16 09:58:24 +00:00
<?php
use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CompanyArticleController;
use App\Http\Controllers\FileController;
use App\Http\Controllers\FormsController;
use App\Http\Controllers\GeneralFormController;
use Symfony\Component\Process\Process;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::post('/form/submit', [FormsController::class, 'handleFormSubmission'])->name("form.submit");
require __DIR__ . '/auth.php';
Route::middleware('auth')->group(function () {
Route::post('/upload', [FileController::class, 'upload'])->name('upload');
Route::group(['prefix' => 'files', 'middleware' => ['web', 'auth']], function () {
\UniSharp\LaravelFilemanager\Lfm::routes();
});
Route::middleware('auth')->get('/dashboard', function () {
return view('backend.dashboard');
});
Route::middleware('auth')->prefix('admin')->group(function () {
Route::get('/dashboard', function () {
return view('backend.dashboard');
});
Route::get('/', function () {
return view('backend.dashboard');
})->name('admin.dashboard');
Route::get('/backup', function () {
$databaseName = env('DB_DATABASE');
$backupFileName = 'backup_' . date('Y-m-d_His') . '.sql';
$backupPath = storage_path('app/' . $backupFileName);
// Create the mysqldump command
$command = sprintf(
'mysqldump --user=%s --password=%s --host=%s %s > %s',
env('DB_USERNAME'),
env('DB_PASSWORD'),
env('DB_HOST'),
$databaseName,
$backupPath
);
// Run the mysqldump command using Symfony Process
$process = new Process(explode(' ', $command));
$process->run();
echo $backupPath;
die;
if (!$process->isSuccessful()) {
return back()->with('error', 'Failed to create backup: ' . $process->getErrorOutput());
}
// Provide the download link for the backup file
return response()->download($backupPath)->deleteFileAfterSend(true);
})->name('backup.db');
});
Route::prefix("form")->group(function () {
Route::get('/tables', [GeneralFormController::class, 'tables'])->name('form.tables');
Route::get('/', [GeneralFormController::class, 'create'])->name('form.create');
Route::get('/store', [GeneralFormController::class, 'store'])->name('form.store');
Route::get('/make-table-nullable', [GeneralFormController::class, 'getTableNullablecreate'])->name('table.create');
Route::get('/store', [GeneralFormController::class, 'store'])->name('form.store');
});
Route::get('/shortcodes', function () {
return view("backend.shortcodes");
})->name('shortcodes');
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
require __DIR__ . '/route.settings.php';
require __DIR__ . '/route.campaigns.php';
require __DIR__ . '/route.branches.php';
require __DIR__ . '/CRUDgenerated/route.countries.php';
require __DIR__ . '/CRUDgenerated/route.provinces.php';
require __DIR__ . '/CRUDgenerated/route.districts.php';
require __DIR__ . '/CRUDgenerated/route.cities.php';
require __DIR__ . '/CRUDgenerated/route.agents.php';
require __DIR__ . '/CRUDgenerated/route.leadcategories.php';
require __DIR__ . '/CRUDgenerated/route.qualifications.php';
require __DIR__ . '/CRUDgenerated/route.sources.php';
require __DIR__ . '/CRUDgenerated/route.registrations.php';
require __DIR__ . '/CRUDgenerated/route.students.php';
require __DIR__ . '/CRUDgenerated/route.followups.php';
require __DIR__ . '/CRUDgenerated/route.faqs.php';
require __DIR__ . '/CRUDgenerated/route.users.php';
require __DIR__ . '/CRUDgenerated/route.campaignarticles.php';
require __DIR__ . '/CRUDgenerated/route.institutiontypes.php';
require __DIR__ . '/CRUDgenerated/route.institutions.php';
require __DIR__ . '/CRUDgenerated/route.programs.php';
require __DIR__ . '/CRUDgenerated/route.options.php';
require __DIR__ . '/CRUDgenerated/route.offerapplications.php';
require __DIR__ . '/CRUDgenerated/route.requireddocuments.php';
require __DIR__ . '/CRUDgenerated/route.contactus.php';
2024-04-24 04:32:18 +00:00
require __DIR__ . '/CRUDgenerated/route.logos.php';
require __DIR__ . '/route.testimonials.php';
2024-04-16 09:58:24 +00:00
});
require __DIR__ . '/route.ajax.php';
require __DIR__ . '/route.client.php';