/** * Display the specified resource. * * @param Project $project * @return \Illuminate\Http\Response */ public function show(Project $project) { $jobs = $project->PrintJob; $settings = SlicerSetting::All(); return view('project.show', compact('project', 'settings', 'jobs'))->with('menu_project', $project); }
/** * Remove the specified resource from storage. * * @param SlicerSetting $setting * @return \Illuminate\Http\Response * @throws \Exception * @internal param int $id */ public function destroy(SlicerSetting $setting) { $setting->delete(); return redirect('slicersetting'); }
/** * Update the specified resource in storage. * * @param PrintJobRequest|\Illuminate\Http\Request $request * @param PrintJob $printjob * @return \Illuminate\Http\Response * @internal param int $id */ public function update(PrintJobRequest $request, PrintJob $printjob) { if ($request->file_name != "" && Storage::disk('local')->exists($printjob->file_name . $printjob->file_extension)) { array_map('unlink', glob(storage_path("app/" . $printjob->file_name . "*"))); } $printjob->update($request->all()); $file = Request::file('stl'); if ($file != null) { $extension = $file->getClientOriginalExtension(); $new_filename = $file->getFilename() . '.' . $extension; Storage::disk('local')->put($new_filename, File::get($file)); $printjob->name = $file->getClientOriginalName(); $printjob->file_name = $file->getFilename(); $printjob->file_extension = "." . $extension; $printjob->save(); foreach (SlicerSetting::All() as $setting) { $this->dispatch(new ProcessSTL($printjob, $setting)); } } return redirect('printjob/' . $printjob->id); }