OutTransactionController.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\OutTransaction;
  4. use App\Services\ParkingFeeService;
  5. use Carbon\Carbon;
  6. use Illuminate\Http\Request;
  7. class OutTransactionController extends Controller
  8. {
  9. /**
  10. * Display a listing of the resource.
  11. *
  12. * @return \Illuminate\Http\Response
  13. */
  14. public function index()
  15. {
  16. //
  17. }
  18. /**
  19. * Show the form for creating a new resource.
  20. *
  21. * @return \Illuminate\Http\Response
  22. */
  23. public function create()
  24. {
  25. //
  26. }
  27. /**
  28. * Store a newly created resource in storage.
  29. *
  30. * @param \Illuminate\Http\Request $request
  31. * @return \Illuminate\Http\Response
  32. */
  33. public function store(Request $request)
  34. {
  35. //
  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. $outTransaction = OutTransaction::find($id);
  46. return inertia('outtransaction/Show', [
  47. 'outTransaction' => [[
  48. 'entryCar' => $outTransaction->entryTransaction->created_at,
  49. 'outCar' => $outTransaction->created_at,
  50. 'totalTimeParking' => Carbon::parse(
  51. $outTransaction->getRawOriginal('created_at')
  52. )->diffForHumans(
  53. $outTransaction->entryTransaction->getRawOriginal('created_at')
  54. ),
  55. 'totalPriceParking' => ParkingFeeService::totalPriceParkingString($outTransaction->entry_transaction_id),
  56. 'platNumber' => $outTransaction->plat_number,
  57. 'entryTransactionId' => $outTransaction->entry_transaction_id
  58. ]],
  59. 'user' => $outTransaction->user->name
  60. ]);
  61. }
  62. /**
  63. * Show the form for editing the specified resource.
  64. *
  65. * @param int $id
  66. * @return \Illuminate\Http\Response
  67. */
  68. public function edit($id)
  69. {
  70. //
  71. }
  72. /**
  73. * Update the specified resource in storage.
  74. *
  75. * @param \Illuminate\Http\Request $request
  76. * @param int $id
  77. * @return \Illuminate\Http\Response
  78. */
  79. public function update(Request $request, $id)
  80. {
  81. //
  82. }
  83. /**
  84. * Remove the specified resource from storage.
  85. *
  86. * @param int $id
  87. * @return \Illuminate\Http\Response
  88. */
  89. public function destroy($id)
  90. {
  91. //
  92. }
  93. }