IndexController.php 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Module\Base;
  4. use Redirect;
  5. /**
  6. * 页面
  7. * Class IndexController
  8. * @package App\Http\Controllers
  9. */
  10. class IndexController extends Controller
  11. {
  12. public function __invoke($method, $action = '', $child = '')
  13. {
  14. $app = $method ? $method : 'main';
  15. if ($action) {
  16. $app .= "__" . $action;
  17. }
  18. return (method_exists($this, $app)) ? $this->$app($child) : Base::ajaxError("404 not found (" . str_replace("__", "/", $app) . ").");
  19. }
  20. /**
  21. * 首页
  22. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  23. */
  24. public function main()
  25. {
  26. return view('main', ['version' => Base::version]);
  27. }
  28. /**
  29. * 接口文档
  30. * @return \Illuminate\Http\RedirectResponse
  31. */
  32. public function api()
  33. {
  34. return Redirect::to(Base::fillUrl('docs'), 301);
  35. }
  36. }