Beispiel #1
0
 /**
  * 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);
 }
Beispiel #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $user = \Auth::user();
     $library = Library::findOrFail($id);
     $POrecord = $library->POrecord;
     $POrecord->status = 'QualityControl';
     $POrecord->save();
     $project = $POrecord->project;
     Library_Samples::where('library_id', '=', $library->id)->delete();
     $library->delete();
     return \Redirect::to('research/ngs/projects/show/' . $project->id)->with('message', 'Your Library has been deleted!');
 }