/**
  * 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);
 }