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) { // $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first(); $station->loadMissing([ "stationTasks_today.stationTaskCommodities.commodity.barcodes", "stationTasks_today.stationTaskCommodities.materialBox", "stationTasks_today.stationTaskBatches.batch.owner", "stationTasks_today.stationTaskMaterialBoxes.materialBox", "stationTypeBinMonitor", ]); if (!$station['stationTypeBinMonitor']){ StationTypeBinMonitor::query()->create([ 'station_id' => $station['id'], 'bin_row_length' => 4, 'bin_column_length' => 5, 'bin_wall_amount' => 2, ]); $station->load("stationTypeBinMonitor"); } // dd( // data_get($station['stationTasks_today'],'*.id') // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.code') // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.id') // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.id') // ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[7],'*.id') // ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[9],'*.id') // ); // $station=$station->toJson(); return view('station.monitor.show',compact('station')); } /** * 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) { // } }