Beispiel #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $people = People::all();
     $cpu = asset::whereRaw('status = "idle" and type = "cpu"')->get();
     $memory = asset::whereRaw('status="idle" and type="memory"')->get();
     $mainboard = asset::whereRaw('status="idle" and type="mainboard"')->get();
     $harddisk = asset::whereRaw('status="idle" and type="harddisk"')->get();
     $device = devices::find($id);
     $owner = $device->belongsTopeople;
     $device['owner'] = $owner;
     $asset = array();
     $asset['cpu'] = asset::whereRaw('type="cpu" and device_id=' . $id . ' and status="using"')->get();
     $asset['memory'] = asset::whereRaw('type="memory" and device_id=' . $id . ' and status="using"')->get();
     $asset['harddisk'] = asset::whereRaw('type="harddisk" and device_id=' . $id . ' and status="using"')->get();
     $asset['mainboard'] = asset::whereRaw('type="mainboard" and device_id=' . $id . ' and status="using"')->get();
     return view('hardware.editdevice')->withDevices($device)->withPeople($people)->withCpu($cpu)->withMemory($memory)->withMainboard($mainboard)->withHarddisk($harddisk)->withAsset($asset);
 }