TanchoToplineCargo/routes/web.php
2024-05-05 10:32:49 +05:45

113 lines
4.7 KiB
PHP

<?php
use App\Http\Controllers\BackendController;
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',[BackendController::class,'displayBackend']);
Route::middleware('auth')->prefix('admin')->group(function () {
Route::get('/dashboard', [BackendController::class,'displayBackend']);
Route::get('/',[BackendController::class,'displayBackend'])->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.companyarticles.php';
require __DIR__ . '/route.recruitmentarticles.php';
require __DIR__ . '/route.otherarticles.php';
require __DIR__ . '/route.countries.php';
require __DIR__ . '/route.companies.php';
require __DIR__ . '/route.job_categories.php';
require __DIR__ . '/route.jobdemands.php';
require __DIR__ . '/route.paperdemands.php';
require __DIR__ . '/route.sliders.php';
require __DIR__ . '/route.galleries.php';
require __DIR__ . '/route.photos.php';
require __DIR__ . '/route.news.php';
require __DIR__ . '/route.settings.php';
require __DIR__ . '/route.menulocations.php';
require __DIR__ . '/route.menuitems.php';
require __DIR__ . '/route.customfields.php';
require __DIR__ . '/route.forms.php';
require __DIR__ . '/route.contacts.php';
require __DIR__ . '/route.users.php';
require __DIR__ . '/route.teams.php';
require __DIR__ . '/route.certificates.php';
require __DIR__ . '/route.shortcodes.php';
require __DIR__ . '/route.testimonials.php';
require __DIR__ . '/CRUDgenerated/route.franchises.php';
require __DIR__ . '/CRUDgenerated/route.services.php';
require __DIR__ . '/CRUDgenerated/route.partners.php';
});
require __DIR__ . '/route.subscribers.php';
require __DIR__ . '/route.client.php';