/** * Show the form for creating a new resource. * * @return Response */ public function create($id) { // $POrecord = POcase::findOrFail($id); $project_id = $POrecord->project->id; $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', $project_id)->first(); $labmans = DB::table('users')->select('id', 'name')->get(); $user = User::find(\Auth::id()); $library = Library::where('POrecord_id', '=', $POrecord->id)->first(); $Library_Samples = Library_Samples::where('library_id', '=', $library->id)->get()->toArray(); return view('research.sequencing.create')->with('user', $user)->with('project', $project)->with('labmans', $labmans)->with('POrecord', $POrecord)->with('Library_Samples', $Library_Samples); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $caseClosed = CaseClosed::findOrFail($id); $POrecord = $caseClosed->POrecord; $project_id = $POrecord->project->id; $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', $project_id)->first(); $labmans = DB::table('users')->select('id', 'name')->get(); $user = User::find(\Auth::id()); $qualityControl = QualityControl::where('POrecord_id', '=', $POrecord->id)->first(); if ($qualityControl->QCtype == 'DNA') { $qcReportUrl = url('research/ngs/qualityControl/dnareport') . '/' . $qualityControl->id; } elseif ($qualityControl->QCtype == 'RNA') { $qcReportUrl = url('research/ngs/qualityControl/rnareport') . '/' . $qualityControl->id; } $library = Library::where('POrecord_id', '=', $POrecord->id)->first(); $libraryReportUrl = url('research/ngs/library/report') . '/' . $library->id; return view('research.caseClosed.edit')->with('user', $user)->with('project', $project)->with('labmans', $labmans)->with('POrecord', $POrecord)->with('qcReportUrl', $qcReportUrl)->with('libraryReportUrl', $libraryReportUrl)->with('caseClosed', $caseClosed); }