OwnerLogisticFeeDetailController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Owner;
  4. use App\OwnerLogisticFeeDetail;
  5. use App\Services\OwnerLogisticFeeDetailService;
  6. use Illuminate\Http\Request;
  7. class OwnerLogisticFeeDetailController extends Controller
  8. {
  9. /** @var $service OwnerLogisticFeeDetailService */
  10. private $service;
  11. /**
  12. * Display a listing of the resource.
  13. *
  14. */
  15. public function index(Request $request)
  16. {
  17. $paginateParams = $request->input();
  18. $this->service = app('OwnerLogisticFeeDetailService');
  19. $this->userService = app('UserService');
  20. $permittingOwnerIds = $this->userService->getPermittingOwnerIds(auth()->user());
  21. if (is_null($request->owner_id)) {
  22. $owner_id = $permittingOwnerIds[0];
  23. } else {
  24. $owner_id = $request->owner_id;
  25. }
  26. if (is_null($request->start)) {
  27. $start = now()->subMonth()->startOfMonth()->toDateString();
  28. } else {
  29. $start = $request->start;
  30. }
  31. if (is_null($request->end)) {
  32. $end = now()->subMonth()->endOfMonth()->toDateString();
  33. } else {
  34. $end = $request->end;
  35. }
  36. $details = $this->service->getDetails($owner_id, $start, $end, $paginateParams);
  37. $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
  38. $owner = Owner::query()->selectRaw("name")->find($owner_id);
  39. return view('finance.settlementBills.logisticFee.detail.index', compact('details', 'paginateParams', 'owners','owner'));
  40. }
  41. /**
  42. * Show the form for creating a new resource.
  43. *
  44. * @return \Illuminate\Http\Response
  45. */
  46. public function create()
  47. {
  48. //
  49. }
  50. /**
  51. * Store a newly created resource in storage.
  52. *
  53. * @param \Illuminate\Http\Request $request
  54. * @return \Illuminate\Http\Response
  55. */
  56. public function store(Request $request)
  57. {
  58. //
  59. }
  60. /**
  61. * Display the specified resource.
  62. *
  63. * @param \App\OwnerLogisticFeeDetail $ownerLogisticFeeDetail
  64. * @return \Illuminate\Http\Response
  65. */
  66. public function show(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
  67. {
  68. //
  69. }
  70. /**
  71. * Show the form for editing the specified resource.
  72. *
  73. * @param \App\OwnerLogisticFeeDetail $ownerLogisticFeeDetail
  74. * @return \Illuminate\Http\Response
  75. */
  76. public function edit(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
  77. {
  78. //
  79. }
  80. /**
  81. * Update the specified resource in storage.
  82. *
  83. * @param \Illuminate\Http\Request $request
  84. * @param \App\OwnerLogisticFeeDetail $ownerLogisticFeeDetail
  85. * @return \Illuminate\Http\Response
  86. */
  87. public function update(Request $request, OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
  88. {
  89. //
  90. }
  91. /**
  92. * Remove the specified resource from storage.
  93. *
  94. * @param \App\OwnerLogisticFeeDetail $ownerLogisticFeeDetail
  95. * @return \Illuminate\Http\Response
  96. */
  97. public function destroy(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
  98. {
  99. //
  100. }
  101. }