SystemController.php 1.8 KB

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