SystemController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 = array();
  17. $infos['Date'] = date(DATE_RFC2822);
  18. $infos['userAgent'] = $request->header('user-agent');
  19. // App info
  20. $infos['Version'] = config('2fauth.version');
  21. $infos['Environment'] = config('app.env');
  22. $infos['Debug'] = var_export(config('app.debug'), true);
  23. $infos['Cache driver'] = config('cache.default');
  24. $infos['Log channel'] = config('logging.default');
  25. $infos['Log level'] = env('LOG_LEVEL');
  26. $infos['DB driver'] = DB::getDriverName();
  27. // PHP info
  28. $infos['PHP version'] = PHP_VERSION;
  29. $infos['Operating system'] = PHP_OS;
  30. $infos['interface'] = PHP_SAPI;
  31. // Auth info
  32. $infos['Auth guard'] = config('auth.defaults.guard');
  33. if ($infos['Auth guard'] === 'reverse-proxy-guard') {
  34. $infos['Auth proxy header for user'] = config('auth.auth_proxy_headers.user');
  35. $infos['Auth proxy header for email'] = config('auth.auth_proxy_headers.email');
  36. }
  37. $infos['webauthn user verification'] = config('larapass.login_verify');
  38. $infos['Trusted proxies'] = config('2fauth.trustedProxies') ?: 'none';
  39. // User info
  40. if ($request->user()) {
  41. $infos['options'] = Settings::all()->toArray();
  42. }
  43. return response()->json($infos);
  44. }
  45. }