with('stationType:name','parent:name')->whereHas('stationType',function($query){ /** @var Builder $query */ $query->where('name','料箱监视器'); })->paginate(100); return view('station.monitor.index',compact('stations')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // } public function show(Station $station) { // } public function monitorShow(Station $station) { $wall = StationTypeBinMonitor::query()->where("station_id",$station->id)->first(); if (!$wall)$wall = factory(StationTypeBinMonitor::class)->make(StationTypeBinMonitor::$default); return view('station.monitor.show',compact('station',"wall")); } /** * Show the form for editing the specified resource. * * @param \App\Station $station * @return \Illuminate\Http\Response */ public function edit(Station $station) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Station $station * @return \Illuminate\Http\Response */ public function update(Request $request, Station $station) { // } /** * Remove the specified resource from storage. * * @param \App\Station $station * @return \Illuminate\Http\Response */ public function destroy(Station $station) { // } }