StationController.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. $wall = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
  51. if (!$wall)$wall = factory(StationTypeBinMonitor::class)->make(StationTypeBinMonitor::$default);
  52. return view('station.monitor.show',compact('station',"wall"));
  53. }
  54. /**
  55. * Show the form for editing the specified resource.
  56. *
  57. * @param \App\Station $station
  58. * @return \Illuminate\Http\Response
  59. */
  60. public function edit(Station $station)
  61. {
  62. //
  63. }
  64. /**
  65. * Update the specified resource in storage.
  66. *
  67. * @param \Illuminate\Http\Request $request
  68. * @param \App\Station $station
  69. * @return \Illuminate\Http\Response
  70. */
  71. public function update(Request $request, Station $station)
  72. {
  73. //
  74. }
  75. /**
  76. * Remove the specified resource from storage.
  77. *
  78. * @param \App\Station $station
  79. * @return \Illuminate\Http\Response
  80. */
  81. public function destroy(Station $station)
  82. {
  83. //
  84. }
  85. }