openstamanager/routes/web.php

154 lines
4.8 KiB
PHP
Raw Normal View History

<?php
use App\Http\Controllers\ConfigurationController;
use App\Http\Controllers\HookController;
use App\Http\Controllers\InfoController;
use App\Http\Controllers\InitializationController;
use App\Http\Controllers\MessageController;
use App\Http\Controllers\RequirementsController;
2021-01-04 11:21:16 +01:00
use App\Http\Controllers\Test;
use App\Http\Controllers\UpdateController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\WidgetModalController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// Percorsi di autenticazione e gestione utenza
require __DIR__.'/auth.php';
// Redirect predefinito a seguito del login
2021-02-20 13:31:52 +01:00
Route::get('/', function () {
$module = auth()->user()->getFirstAvailableModule();
return redirect('controller.php?id_module='.$module->id);
})
->middleware(['auth']);
// Schermata dei requisiti
Route::get('/requirements', [RequirementsController::class, 'index'])
->name('requirements');
// Sezione di configurazione
Route::get('/config', [ConfigurationController::class, 'index'])
->name('configuration');
Route::get('/config-test', [ConfigurationController::class, 'test'])
->name('configuration-test');
Route::post('/config', [ConfigurationController::class, 'save'])
->name('configuration-save');
2021-01-04 11:21:16 +01:00
// Installazione aggiornamenti del gestionale
Route::get('/update', [UpdateController::class, 'index'])
->name('update');
Route::post('/update', [UpdateController::class, 'execute'])
->name('update-execute');
// Inizializzazione del gestionale
Route::get('/init', [InitializationController::class, 'index'])
->name('initialization');
Route::post('/init', [InitializationController::class, 'save'])
->name('initialization-save');
2021-01-04 11:21:16 +01:00
// Messaggi flash
Route::get('/messages', [MessageController::class, 'index'])
2021-01-04 11:21:16 +01:00
->name('messages');
// Operazioni Ajax
Route::prefix('ajax')
->group(function () {
Route::get('/select', [Test::class, 'index'])
->name('ajax-select');
Route::get('/complete', [Test::class, 'index'])
->name('ajax-complete');
Route::get('/search', [Test::class, 'index'])
->name('ajax-search');
// Sessioni
Route::get('/session/', [Test::class, 'index'])
->name('ajax-session');
Route::get('/session-array/', [Test::class, 'index'])
->name('ajax-session-array');
// Dataload
Route::get('/dataload/{module_id}/{reference_id?}', [Test::class, 'index'])
->where('module_id', '[0-9]+')
->where('reference_id', '[0-9]+')
->name('ajax-dataload');
});
2021-01-04 11:21:16 +01:00
// Hooks
Route::prefix('hook')
->middleware(['auth'])
->group(function () {
Route::get('/list', [HookController::class, 'list'])
->name('hooks');
2021-01-04 11:21:16 +01:00
Route::get('/lock/{hook_id}', [HookController::class, 'lock'])
->whereNumber('hook_id')
->name('hook-lock');
2021-01-04 11:21:16 +01:00
Route::get('/execute/{hook_id}/{token}', [HookController::class, 'execute'])
->whereNumber('hook_id')
->name('hook-execute');
2021-01-04 11:21:16 +01:00
Route::get('/response/{hook_id}', [HookController::class, 'response'])
->whereNumber('hook_id')
->name('hook-response');
});
2021-01-04 11:21:16 +01:00
// Informazioni su OpenSTAManager
Route::get('/info', [InfoController::class, 'info'])
->middleware(['auth'])
2021-01-04 11:21:16 +01:00
->name('info');
// Segnalazione bug
Route::prefix('bug')
->middleware(['auth'])
->group(function () {
Route::get('', [InfoController::class, 'bug'])
->name('bug');
Route::post('', [InfoController::class, 'send'])
->name('bug-send');
});
2021-01-04 11:21:16 +01:00
// Log di accesso
Route::get('/logs', [UserController::class, 'logs'])
->middleware(['auth'])
2021-01-04 11:21:16 +01:00
->name('logs');
// Log di accesso
Route::get('/widget/modal/{id}', [WidgetModalController::class, 'modal'])
->whereNumber('id')
->middleware(['auth'])
->name('widget-modal');
2021-01-04 11:21:16 +01:00
// Informazioni sull'utente
Route::prefix('user')
->middleware(['auth'])
->group(function () {
Route::get('/info', [UserController::class, 'index'])
->name('user-info');
Route::get('/password', [UserController::class, 'password'])
->name('user-password');
Route::post('/password', [UserController::class, 'savePassword'])
->name('user-password-save');
Route::get('/photo', [UserController::class, 'photo'])
->name('user-photo');
2021-01-04 11:21:16 +01:00
Route::post('/photo', [UserController::class, 'savePhoto'])
->name('user-photo-save');
});