|
|
|
@ -1,6 +1,6 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
Route::group(['middleware' => ['web','role:admin'],'prefix' => 'reports'], function() { |
|
|
|
Route::group(['middleware' => ['web', 'auth'], 'prefix' => 'reports'], function () { |
|
|
|
/** |
|
|
|
* Reports Routes |
|
|
|
*/ |
|
|
|
@ -11,8 +11,9 @@ Route::group(['middleware' => ['web','role:admin'],'prefix' => 'reports'], funct |
|
|
|
Route::get('current-credits', ['as' => 'reports.current-credits', 'uses' => 'ReportsController@currentCredits']); |
|
|
|
|
|
|
|
Route::get('log-files', ['as' => 'log-files.index', 'uses' => function () { |
|
|
|
if (!file_exists(storage_path('logs'))) |
|
|
|
if ( ! file_exists(storage_path('logs'))) { |
|
|
|
return []; |
|
|
|
} |
|
|
|
|
|
|
|
$logFiles = \File::allFiles(storage_path('logs')); |
|
|
|
|
|
|
|
@ -25,15 +26,17 @@ Route::group(['middleware' => ['web','role:admin'],'prefix' => 'reports'], funct |
|
|
|
}]); |
|
|
|
|
|
|
|
Route::get('log-files/{filename}', ['as' => 'log-files.show', 'uses' => function ($fileName) { |
|
|
|
if (file_exists(storage_path('logs/' . $fileName))) |
|
|
|
if (file_exists(storage_path('logs/'.$fileName))) { |
|
|
|
return response()->file(storage_path('logs/'.$fileName), ['content-type' => 'text/plain']); |
|
|
|
} |
|
|
|
|
|
|
|
return 'Invalid file name.'; |
|
|
|
}]); |
|
|
|
|
|
|
|
Route::get('log-files/{filename}/download', ['as' => 'log-files.download', 'uses' => function ($fileName) { |
|
|
|
if (file_exists(storage_path('logs/' . $fileName))) |
|
|
|
if (file_exists(storage_path('logs/'.$fileName))) { |
|
|
|
return response()->download(storage_path('logs/'.$fileName), env('APP_ENV').'.'.$fileName); |
|
|
|
} |
|
|
|
|
|
|
|
return 'Invalid file name.'; |
|
|
|
}]); |
|
|
|
|