| $nested_data = array(); | $nested_data = array(); | ||||
| if($type == 'null' && $building == 'null' && $dealer == 'null'){ | if($type == 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->get(); | |||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(2)->get(); | |||||
| }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | ||||
| }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | ||||
| $q->where('building_name', $building)->get(); | $q->where('building_name', $building)->get(); | ||||
| }],'PackageDetail','WorkOrder')->where('type_service',$type)->where('company_id',$dealer)->orderBy('created_at', 'desc')->get(); | }],'PackageDetail','WorkOrder')->where('type_service',$type)->where('company_id',$dealer)->orderBy('created_at', 'desc')->get(); | ||||
| } | } | ||||
| if(!empty($form)){ | if(!empty($form)){ | ||||
| foreach ($form as $key => $f) { | foreach ($form as $key => $f) { | ||||
| if(empty($f->WorkOrder)){ | if(empty($f->WorkOrder)){ | ||||
| // Send JSON to the client. | // Send JSON to the client. | ||||
| echo $json; | echo $json; | ||||
| } | } | ||||
| } | |||||
| } |