public function run() { DB::table('libraries')->delete(); $collection = [['fileclass_id' => 3, 'title' => 'ACH Authorization', 'filename' => 'ACH Authorization.docx', 'version' => 1, 'description' => 'none given', 'state_id' => null, 'path' => 'legal/', 'doctype_id' => 2, 'filetype_id' => 1, 'distributor_id' => null]]; foreach ($collection as $record) { Library::create($record); } }
/** * Run the database seeds. * * @return void */ public function run() { Library::truncate(); $dummy = Faker::create(); $resources = Resource::all()->lists('id')->toArray(); foreach ($resources as $resource) { foreach (range(5, 30) as $index) { Library::create(['author' => $dummy->name, 'title' => $dummy->company, 'resource_id' => $resource, 'publication' => $dummy->catchPhrase, 'quantity' => $dummy->randomDigitNotNull, 'is_active' => $dummy->boolean, 'purchased_at' => date('Y-m-d H:i:s')]); } } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Library::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
/** * 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); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $library = Library::findOrFail($id); try { File::delete(public_path() . '/uploads/library/' . $library->image); $library->destroy($id); } catch (Exception $e) { App::abort(404); } return Redirect::route('admin.library.show'); }
/** * 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); }
public function ShowLibrary() { $data['library'] = Library::orderBy('created_at', 'asc')->get(); return view('site.library', $data); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $library = Library::findOrFail($id); $library->delete(); return view('admin/libraries'); }
public function report($id) { $library = Library::find($id); $glob = glob(base_path() . '/storeFiles/ngs/libraryqc_report/{*.pdf}', GLOB_BRACE); $fileTimestamp = 20150101; foreach ($glob as $file) { if (preg_match("/{$id}\\-(\\d+)\\.pdf/", $file, $matches)) { // Valid match if ($matches[1] > $fileTimestamp) { $fileTimestamp = $matches[1]; } } } $filepath = base_path() . '/storeFiles/ngs/libraryqc_report/' . $id . '-' . $fileTimestamp . '.pdf'; return response()->download($filepath, $library->POrecord->poNum . '-Library_QC_Report-' . $fileTimestamp . '.pdf'); }