VehiclePhoto.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace catchAdmin\yunying\controller;
  3. use catcher\base\CatchRequest as Request;
  4. use catcher\CatchResponse;
  5. use catcher\base\CatchController;
  6. use catchAdmin\yunying\model\VehiclePhoto as vehiclePhotoModel;
  7. class VehiclePhoto extends CatchController
  8. {
  9. protected $vehiclePhotoModel;
  10. public function __construct(vehiclePhotoModel $vehiclePhotoModel)
  11. {
  12. $this->vehiclePhotoModel = $vehiclePhotoModel;
  13. }
  14. /**
  15. * 列表
  16. * @time 2022年01月20日 10:54
  17. * @param Request $request
  18. */
  19. public function index(Request $request) : \think\Response
  20. {
  21. return CatchResponse::paginate($this->vehiclePhotoModel->getList());
  22. }
  23. /**
  24. * 保存信息
  25. * @time 2022年01月20日 10:54
  26. * @param Request $request
  27. */
  28. public function save(Request $request) : \think\Response
  29. {
  30. return CatchResponse::success($this->vehiclePhotoModel->storeBy($request->post()));
  31. }
  32. /**
  33. * 读取
  34. * @time 2022年01月20日 10:54
  35. * @param $id
  36. */
  37. public function read($id) : \think\Response
  38. {
  39. return CatchResponse::success($this->vehiclePhotoModel->findBy($id));
  40. }
  41. /**
  42. * 更新
  43. * @time 2022年01月20日 10:54
  44. * @param Request $request
  45. * @param $id
  46. */
  47. public function update(Request $request, $id) : \think\Response
  48. {
  49. return CatchResponse::success($this->vehiclePhotoModel->updateBy($id, $request->post()));
  50. }
  51. /**
  52. * 删除
  53. * @time 2022年01月20日 10:54
  54. * @param $id
  55. */
  56. public function delete($id) : \think\Response
  57. {
  58. return CatchResponse::success($this->vehiclePhotoModel->deleteBy($id));
  59. }
  60. }