/** * Handle the event. * * @param array $results * @return void */ public function handle($results) { $document_id = $results['user_data']['document_id']; $document = Document::find($document_id); $document->preview_url = $results['preview']['url']; $document->preview = json_encode($results); $document->save(); Event::fire(new FilePreviewsGenerated($document)); }
public function edit($DocumentID) { if (!$this->objLoggedInUser->HasPermission('View/Documents') && !$this->objLoggedInUser->HasPermission('Edit/Documents')) { abort('404'); } $objDocument = $DocumentID == 'new' ? new \App\Document() : \App\Document::find($DocumentID); View::share('objDocument', $objDocument); return view('admin.documents.edit'); }
/** * [update description] * @param [type] $id [description] * @return [type] [description] */ public function update(UpdateDocumentRequest $request, $id) { $document = Document::find($id); if (!$document) { return $this->respondNotFound('Document does not exist'); } // Call fill on the document and pass in the data $document->fill(Input::all()); $document->save(); return $this->respondNoContent(); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $entity = \App\Document::find($id); $wi = new \WorkflowInstance('material-request', $entity->id, $entity->state, $entity); if ($request->get('op_type') == 'state_change') { $new_state = $request->get('new_state'); $wi->setState($new_state); $entity->state = $new_state; $entity->save(); } // end if op_type is state_change return Redirect('/'); }
public function update(Request $request) { $validator = $this->validator($request->all()); if ($validator->fails()) { Flash::error('Impossible de modifier le document. Veuillez vérifier les champs renseignés.'); return Redirect::back()->withErrors($validator->errors()); } $doc = Document::find($request->id); $doc->title = $request->title; $doc->description = $request->description; $doc->save(); Flash::success('Le document a bien été modifié !'); return redirect('admin/documents'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $document = Document::find($id); $document->delete(); Flash::error('El dococumento con el asunto ' . $document->asunto . " ha sido eliminado de forma exitosa."); return redirect()->route('document.index'); }
public function deleteDocument($id) { $document = Document::find($id); if (isset($document)) { Document::where('id', $id)->update(['status' => 'deleted']); } return Redirect::route('documents')->with('success', 'Document deleted successful.'); }
/** * Download the current document as a raw file * @method showpdf * @param [type] $id [description] * @return [type] [description] */ public function showraw($id) { $document = Document::find($id); return Response::download(storage_path('documents') . DIRECTORY_SEPARATOR . $document->raw_file_path); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $documents) { // check that the file is valid if ($request->hasFile('original_file') && (!$request->file('original_file')->isValid() || $request->file('original_file')->getClientMimeType() !== 'text/xml')) { throw new Exception('Please upload a valid xml document.'); } if ($request->hasFile('original_file')) { return $this->storeFile($request); } $input = Input::all(); $document = Document::find($documents); $document->update($input); if (!empty($input['tags'][0])) { Tag::resolveTags($document, explode(',', $input['tags'][0])); } if ($file_original_name = Session::get('file_original_name')) { // get the file $file_temp_name = Session::get('file_temp_name'); $file_temp_path = ".." . DIRECTORY_SEPARATOR . "temp"; $file_temp = $file_temp_path . DIRECTORY_SEPARATOR . $file_temp_name; $file_new_name = "{$document->id}_{$file_original_name}_raw.xml"; $file_new_name_p = "{$document->id}_{$file_original_name}_parsed.pdf"; $file_new_path = ".." . DIRECTORY_SEPARATOR . "documents"; $file_new = $file_new_path . DIRECTORY_SEPARATOR . $file_new_name; Storage::move($file_temp, $file_new); // update the document $document->update(['raw_file_path' => $file_new_name, 'parsed_file_path' => $file_new_name_p]); Event::fire(new DocumentWasUploaded($document)); Session::pull('file_original_name'); Session::pull('file_temp_name'); Session::pull('file_temp_path'); } return $this->operationSuccessful(); }