CommonController.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Http\Controllers\Admin\Base;
  11. use App\Http\Controllers\Controller;
  12. use Illuminate\Support\Facades\Cache;
  13. use Jiannei\Response\Laravel\Support\Facades\Response;
  14. class CommonController extends Controller
  15. {
  16. /**
  17. * 枚举类型
  18. * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Resources\Json\Resource
  19. * Author: Mead
  20. */
  21. public function enums()
  22. {
  23. $data = trans('enums');
  24. $enums = [];
  25. foreach ($data as $key => $val) {
  26. $k = last(str2arr($key, '\\'));
  27. $enums[$k] = $val;
  28. }
  29. return Response::success($enums);
  30. }
  31. /**
  32. * 清空缓存
  33. * @return mixed
  34. * Author: Mead
  35. */
  36. public function clear()
  37. {
  38. Cache::flush();
  39. return Response::noContent();
  40. }
  41. }