StationController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Station;
  4. use App\StationTypeBinMonitor;
  5. use Illuminate\Database\Eloquent\Builder;
  6. use Illuminate\Http\Request;
  7. class StationController extends Controller
  8. {
  9. /**
  10. * Display a listing of the resource.
  11. *
  12. * @return void
  13. */
  14. public function index()
  15. {
  16. }
  17. public function monitorIndex()
  18. {
  19. $stations = Station::query()->with('stationType:name','parent:name')->whereHas('stationType',function($query){
  20. /** @var Builder $query */
  21. $query->where('name','料箱监视器');
  22. })->paginate(100);
  23. return view('station.monitor.index',compact('stations'));
  24. }
  25. /**
  26. * Show the form for creating a new resource.
  27. *
  28. * @return \Illuminate\Http\Response
  29. */
  30. public function create()
  31. {
  32. //
  33. }
  34. /**
  35. * Store a newly created resource in storage.
  36. *
  37. * @param \Illuminate\Http\Request $request
  38. * @return \Illuminate\Http\Response
  39. */
  40. public function store(Request $request)
  41. {
  42. //
  43. }
  44. public function show(Station $station)
  45. {
  46. //
  47. }
  48. public function monitorShow(Station $station)
  49. {
  50. $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
  51. if (!$stationTypeBinMonitor){
  52. $stationTypeBinMonitor =StationTypeBinMonitor::query()->create([
  53. 'station_id' => $station['id'],
  54. 'bin_row_length' => 4,
  55. 'bin_column_length' => 5,
  56. 'bin_wall_amount' => 2,
  57. ]);
  58. }
  59. return view('station.monitor.show',compact('station',"stationTypeBinMonitor"));
  60. }
  61. /**
  62. * Show the form for editing the specified resource.
  63. *
  64. * @param \App\Station $station
  65. * @return \Illuminate\Http\Response
  66. */
  67. public function edit(Station $station)
  68. {
  69. //
  70. }
  71. /**
  72. * Update the specified resource in storage.
  73. *
  74. * @param \Illuminate\Http\Request $request
  75. * @param \App\Station $station
  76. * @return \Illuminate\Http\Response
  77. */
  78. public function update(Request $request, Station $station)
  79. {
  80. //
  81. }
  82. /**
  83. * Remove the specified resource from storage.
  84. *
  85. * @param \App\Station $station
  86. * @return \Illuminate\Http\Response
  87. */
  88. public function destroy(Station $station)
  89. {
  90. //
  91. }
  92. }