2024-06-10 12:21:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Http\Controllers\FileController;
|
|
|
|
use App\Http\Controllers\FormsController;
|
|
|
|
use App\Http\Controllers\GeneralFormController;
|
|
|
|
use App\Http\Controllers\ProfileController;
|
2024-06-23 11:17:56 +00:00
|
|
|
use App\Http\Controllers\PermissionsController;
|
|
|
|
use App\Http\Controllers\UsersController;
|
|
|
|
use App\Http\Controllers\RolesController;
|
2024-06-10 12:21:58 +00:00
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
|
|
|
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');
|
2024-06-23 11:17:56 +00:00
|
|
|
})->name('dashboard');
|
2024-06-10 12:21:58 +00:00
|
|
|
|
|
|
|
Route::middleware('auth')->prefix('admin')->group(function () {
|
|
|
|
Route::get('/dashboard', function () {
|
|
|
|
return view('backend.dashboard');
|
2024-06-23 11:17:56 +00:00
|
|
|
})->name('admin.dashboard');
|
2024-06-10 12:21:58 +00:00
|
|
|
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 as an array
|
|
|
|
$command = [
|
|
|
|
'mysqldump',
|
|
|
|
'--user=' . env('DB_USERNAME'),
|
|
|
|
'--password=' . env('DB_PASSWORD'),
|
|
|
|
'--host=' . env('DB_HOST'),
|
|
|
|
$databaseName,
|
|
|
|
];
|
|
|
|
|
|
|
|
// Run the mysqldump command using Symfony Process
|
|
|
|
$process = new Process($command);
|
|
|
|
$process->setOutputFile($backupPath);
|
|
|
|
$process->run();
|
|
|
|
|
|
|
|
if (!$process->isSuccessful()) {
|
|
|
|
throw new ProcessFailedException($process);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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');
|
|
|
|
|
2024-06-23 11:17:56 +00:00
|
|
|
//roles and permissions
|
2024-06-10 12:21:58 +00:00
|
|
|
|
2024-06-23 11:17:56 +00:00
|
|
|
Route::group([], function () {
|
|
|
|
Route::resource('user', UsersController::class)->names('user');
|
|
|
|
Route::resource('role', RolesController::class)->names('role');
|
|
|
|
Route::resource('permission', PermissionsController::class)->names('permission')->only(['index','destroy']);
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::prefix("permissions")->group(function () {
|
|
|
|
Route::resource('/permissions', PermissionsController::class);
|
|
|
|
Route::get('/generate-permissions', [PermissionsController::class, 'generatePermissionFromRoutes'])->name('permission.generatePermissionFromRoutes');
|
|
|
|
});
|
2024-06-10 12:21:58 +00:00
|
|
|
|
|
|
|
require __DIR__ . '/route.settings.php';
|
|
|
|
require __DIR__ . '/route.menulocations.php';
|
|
|
|
require __DIR__ . '/route.menuitems.php';
|
2024-06-15 16:38:54 +00:00
|
|
|
require __DIR__ . '/route.provinces.php';
|
|
|
|
require __DIR__ . '/route.news_type.php';
|
|
|
|
require __DIR__ . '/route.newscategories.php';
|
|
|
|
require __DIR__ . '/route.news.php';
|
|
|
|
require __DIR__ . '/route.authors.php';
|
|
|
|
require __DIR__ . '/route.economies.php';
|
2024-06-18 05:46:51 +00:00
|
|
|
require __DIR__ . '/route.videos.php';
|
|
|
|
require __DIR__ . '/route.horoscope.php';
|
|
|
|
require __DIR__ . '/route.articles.php';
|
|
|
|
require __DIR__ . '/route.teams.php';
|
2024-06-18 10:41:58 +00:00
|
|
|
require __DIR__ . '/route.advertisements.php';
|
|
|
|
require __DIR__ . '/route.adcategories.php';
|
2024-06-20 10:57:33 +00:00
|
|
|
require __DIR__ . '/route.roles.php';
|
|
|
|
require __DIR__ . '/route.permissions.php';
|
|
|
|
require __DIR__ . '/route.users.php';
|
2024-06-21 07:44:04 +00:00
|
|
|
require __DIR__ . '/route.popups.php';
|
2024-06-23 11:17:56 +00:00
|
|
|
require __DIR__ . '/route.comments.php';
|
2024-06-18 10:41:58 +00:00
|
|
|
|
2024-06-10 12:21:58 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
require __DIR__ . '/route.client.php';
|
|
|
|
|
2024-06-11 12:03:42 +00:00
|
|
|
// Route::fallback([WebsiteController::class, 'fallback']);
|
2024-06-10 12:21:58 +00:00
|
|
|
|