SiteInfoController.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Services\AIModelService;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Response;
  6. use Illuminate\Support\Facades\App;
  7. class SiteInfoController extends Controller
  8. {
  9. /**
  10. * Display a listing of the resource.
  11. *
  12. * @return Response
  13. */
  14. public function index()
  15. {
  16. //
  17. }
  18. /**
  19. * Store a newly created resource in storage.
  20. *
  21. * @return Response
  22. */
  23. public function store(Request $request)
  24. {
  25. //
  26. }
  27. /**
  28. * Display the specified resource.
  29. *
  30. * @param string $language
  31. * @return Response
  32. */
  33. public function show($language)
  34. {
  35. if (! in_array($language, ['en', 'zh-Hans', 'zh-Hant'])) {
  36. App::setLocale('en');
  37. } else {
  38. App::setLocale($language);
  39. }
  40. $model = app(AIModelService::class);
  41. $response = [
  42. 'logo' => __('site.logo'),
  43. 'title' => __('site.title'),
  44. 'subhead' => __('site.subhead'),
  45. 'keywords' => __('site.keywords'),
  46. 'description' => __('site.description'),
  47. 'copyright' => __('site.copyright'),
  48. 'author' => [
  49. 'name' => __('site.author.name'),
  50. 'email' => __('site.author.email'),
  51. ],
  52. 'settings' => [
  53. 'models' => $model->getSysModels(),
  54. ],
  55. ];
  56. return response()->json(
  57. $response,
  58. 200,
  59. [
  60. 'Content-Type' => 'application/json;charset=UTF-8',
  61. 'Charset' => 'utf-8',
  62. ],
  63. JSON_UNESCAPED_UNICODE
  64. );
  65. }
  66. /**
  67. * Update the specified resource in storage.
  68. *
  69. * @param int $id
  70. * @return Response
  71. */
  72. public function update(Request $request, $id)
  73. {
  74. //
  75. }
  76. /**
  77. * Remove the specified resource from storage.
  78. *
  79. * @param int $id
  80. * @return Response
  81. */
  82. public function destroy($id)
  83. {
  84. //
  85. }
  86. }