CollectController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace App\Http\Controllers\Api\V1\Mentality;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Api\V1\BaseController;
  5. use App\Facades\CollectFacade;
  6. class CollectController extends BaseController
  7. {
  8. /**
  9. * Display a listing of the resource.
  10. *
  11. * @return \Illuminate\Http\Response
  12. */
  13. public function index()
  14. {
  15. $conditions = [
  16. 'uid' => $this->auth()
  17. ];
  18. $fields = ['*'];
  19. $sort = '`id` desc';
  20. $page = request('page', 1);
  21. $limit = request('limit', 20);
  22. return CollectFacade::getList($conditions, $fields, $sort, $page, $limit);
  23. }
  24. /**
  25. * Store a newly created resource in storage.
  26. *
  27. * @param \Illuminate\Http\Request $request
  28. * @return \Illuminate\Http\Response
  29. */
  30. public function store(Request $request)
  31. {
  32. $data = $request->only(['column','object_id']);
  33. $data['uid'] = $this->auth();
  34. $data['repeat'] = 'uid:'.$data['uid'].' column:'.$data['column'].' object_id:'.$data['object_id'];
  35. return CollectFacade::create($data);
  36. }
  37. /**
  38. * Display the specified resource.
  39. *
  40. * @param int $id
  41. * @return \Illuminate\Http\Response
  42. */
  43. public function show($id)
  44. {
  45. //
  46. }
  47. /**
  48. * Update the specified resource in storage.
  49. *
  50. * @param \Illuminate\Http\Request $request
  51. * @param int $id
  52. * @return \Illuminate\Http\Response
  53. */
  54. public function update(Request $request, $id)
  55. {
  56. //
  57. }
  58. /**
  59. * Remove the specified resource from storage.
  60. *
  61. * @param int $id
  62. * @return \Illuminate\Http\Response
  63. */
  64. public function destroy($id)
  65. {
  66. //
  67. }
  68. }