SystemController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\SettingService;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\DB;
  7. class SystemController extends Controller
  8. {
  9. /**
  10. * The Settings Service instance.
  11. */
  12. protected SettingService $settingService;
  13. /**
  14. * Create a new controller instance.
  15. */
  16. public function __construct(SettingService $settingService)
  17. {
  18. $this->settingService = $settingService;
  19. }
  20. /**
  21. * Get detailed information about the current installation
  22. *
  23. * @return \Illuminate\Http\JsonResponse
  24. */
  25. public function infos(Request $request)
  26. {
  27. $infos['Date'] = date(DATE_RFC2822);
  28. $infos['userAgent'] = $request->header('user-agent');
  29. // App info
  30. $infos['Version'] = config('2fauth.version');
  31. $infos['Environment'] = config('app.env');
  32. $infos['Debug'] = var_export(config('app.debug'), true);
  33. $infos['Cache driver'] = config('cache.default');
  34. $infos['Log channel'] = config('logging.default');
  35. $infos['Log level'] = env('LOG_LEVEL');
  36. $infos['DB driver'] = DB::getDriverName();
  37. // PHP info
  38. $infos['PHP version'] = PHP_VERSION;
  39. $infos['Operating system'] = PHP_OS;
  40. $infos['interface'] = PHP_SAPI;
  41. // Auth info
  42. $infos['Auth guard'] = config('auth.defaults.guard');
  43. if ($infos['Auth guard'] === 'reverse-proxy-guard') {
  44. $infos['Auth proxy header for user'] = config('auth.auth_proxy_headers.user');
  45. $infos['Auth proxy header for email'] = config('auth.auth_proxy_headers.email');
  46. }
  47. $infos['webauthn user verification'] = config('larapass.login_verify');
  48. $infos['Trusted proxies'] = config('2fauth.trustedProxies') ?: 'none';
  49. // User info
  50. if ($request->user()) {
  51. $infos['options'] = $this->settingService->all()->toArray();
  52. }
  53. return response()->json($infos);
  54. }
  55. }