Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $reportCheck = ReportCheck::findOrFail($id);
     $labmans = DB::table('users')->select('id', 'name')->get();
     $POrecord = $reportCheck->POrecord;
     $analysis = Analysis::where('POrecord_id', '=', $POrecord->id)->first();
     $customersJoinQuery = DB::table('customers')->select(DB::raw('id AS c_id'), 'institute', 'department', 'c_name');
     $usersJoinQuery = DB::table('users')->select(DB::raw('id AS u_id'), 'name');
     $project = DB::table('projects')->leftJoin(DB::raw('(' . $customersJoinQuery->toSql() . ') i'), function ($join) {
         $join->on('projects.Customer_id', '=', 'i.c_id');
     })->leftJoin(DB::raw('(' . $usersJoinQuery->toSql() . ') j'), function ($join) {
         $join->on('projects.salesman', '=', 'u_id');
     })->where('projects.id', $POrecord->project->id)->first();
     return view('research.reportCheck.edit')->with('project', $project)->with('labmans', $labmans)->with('POrecord', $POrecord)->with('analysis', $analysis)->with('reportCheck', $reportCheck);
 }