InformationController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Api\Info;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Info\InformationService;
  5. use Illuminate\Http\Request;
  6. /**
  7. * Information
  8. */
  9. class InformationController extends Controller
  10. {
  11. /**
  12. * @var InformationService
  13. */
  14. private $informationService;
  15. /**
  16. * InformationController constructor.
  17. *
  18. * @param InformationService $informationService
  19. */
  20. public function __construct(InformationService $informationService)
  21. {
  22. parent::__construct();
  23. // $this->middleware('checkUserPermission');
  24. $this->informationService = $informationService;
  25. }
  26. /**
  27. * 列表
  28. * @param Request $request
  29. *
  30. * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Resources\Json\JsonResource
  31. * @throws \Prettus\Repository\Exceptions\RepositoryException
  32. */
  33. public function index(Request $request)
  34. {
  35. $informations = $this->informationService->handleList($request);
  36. return $this->response->success($informations);
  37. }
  38. /**
  39. * 详情
  40. * @param Request $request
  41. * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Resources\Json\JsonResource
  42. */
  43. public function show(Request $request)
  44. {
  45. $this->validate($request, ['id' => 'required|integer']);
  46. $information = $this->informationService->handleProfile($request->get('id'));
  47. return $this->response->success($information);
  48. }
  49. }