public function get($filename)
 {
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $file = Storage::disk('local')->get($entry->filename);
     //dd(Response($file, 200)->header('Content-Type', $entry->mine));
     return Response($file, 200)->header('Content-Type', $entry->mine);
 }
Ejemplo n.º 2
0
 public function getThumbnail($filename)
 {
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $fs = new FileStorageController();
     $file = $fs->getImage($entry->thumbnail_path);
     return (new Response($file, 200))->header('Content-Type', $entry->mime);
 }
Ejemplo n.º 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $provider = Providers::findOrFail($id);
     $entries = Fileentry::where('idProvider', '=', $id)->paginate(10);
     $entries->setPath($id);
     return view('providers.show', compact('provider', 'entries'));
 }
 public function delete($filename)
 {
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $file = Storage::disk('local')->delete($entry->filename);
     if ($file) {
         Fileentry::where('filename', '=', $filename)->delete();
     }
     return redirect('fileentry')->with('status', 'Profile updated!');
 }
Ejemplo n.º 5
0
 public function borrar($filename)
 {
     $archivo = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $exists = Storage::disk('local')->exists($archivo->filename);
     if ($exists) {
         Storage::delete($archivo->filename);
         $archivo->delete();
         flash()->overlay('Ha sido borrado sactifactoriamente', 'El archivo ' . $archivo->filename);
     }
 }
Ejemplo n.º 6
0
 public function get($filename)
 {
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $file = \Storage::disk('local')->get($entry->filename);
     return $file;
     // dd($file);
     // dd(get_class_methods(new Response($file, 200)));
     // return (new Response($file, 200))
     //          ->header('Content-Type', $entry->mime);
 }
Ejemplo n.º 7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  \App\Fileentry $filename
  * @return Response
  */
 public function destroy($filename)
 {
     //$filename->delete();
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $entry->delete();
     Storage::disk('local')->delete($entry->filename);
     $entries = Fileentry::all();
     return Redirect('superadmin/filemanager')->with('message', 'File deleted.')->with('entries', $entries);
     // show after destroy post
     //return view('posts.show', compact('post'));
 }
 public function destroy(Request $request, Fileentry $fileentry)
 {
     $entry = Fileentry::where('id', '=', $fileentry->id)->firstOrFail();
     $model = explode(",", $entry->model_id);
     $file = Storage::disk('local')->delete($entry->filename);
     $fname = $entry->original_filename;
     $fileentry->delete();
     Log::info('Deleted Files:' . $fname);
     $request->session()->flash('alert-success', 'File successful deleted!');
     if ($request->redirect == 'fileentries') {
         return redirect('/fileentries?page=' . $request->page);
     } else {
         return redirect('/' . $model[0] . '/' . $model[1] . '/update?page=' . $request->page . '&filetab=1');
     }
 }
Ejemplo n.º 9
0
 public function show($idp)
 {
     $entries = Fileentry::where('idProvider', '=', $idp)->get();
     return view('fileentries.show', compact('entries'));
 }
Ejemplo n.º 10
0
 public function getFiles()
 {
     $model_id = "note," . $this->id;
     return Fileentry::where('model_id', '=', $model_id)->orderBy('original_filename')->get();
 }
Ejemplo n.º 11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $provider = Providers::findOrFail($id);
     $entries = Fileentry::where('idProvider', '=', '1')->get();
     return view('providers.show', compact('provider', 'entries'));
 }
Ejemplo n.º 12
0
 /**
  * Destroy the given Note.
  *
  * @param  Request  $request
  * @param  Note  $note
  * @return Response
  */
 public function destroy(Request $request, Note $note)
 {
     //first we have to delelte all the files
     $model_id = 'note,' . $note->id;
     $entries = Fileentry::where('model_id', '=', $model_id)->get();
     foreach ($entries as $entry) {
         $file = Storage::disk('local')->delete($entry->filename);
         $fname = $entry->original_filename;
         $entry->delete();
         Log::info('Deleted Files:' . $fname);
     }
     $note->delete();
     $request->session()->flash('alert-success', 'Note was successful deleted!');
     $page = $request->session()->get('note_page');
     return redirect('/notes?page=' . $page);
 }
Ejemplo n.º 13
0
 public function get($filename)
 {
     $entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
     $file = Storage::disk('avatar')->get($entry->filename);
     return (new Response($file, 200))->header('Content-Type', $entry->mime);
 }
Ejemplo n.º 14
0
 /**
  * Destroy the given task.
  *
  * @param  Request  $request
  * @param  Task  $task
  * @return Response
  */
 public function destroy(Request $request, Task $task)
 {
     //first we have to delelte all the files
     $model_id = 'task,' . $task->id;
     $entries = Fileentry::where('model_id', '=', $model_id)->get();
     foreach ($entries as $entry) {
         $file = Storage::disk('local')->delete($entry->filename);
         $fname = $entry->original_filename;
         $entry->delete();
         Log::info('Deleted Files:' . $fname);
     }
     $this->authorize('destroy', $task);
     $task->delete();
     $request->session()->flash('alert-success', 'Task was successful deleted!');
     $page = $request->session()->get('page');
     return redirect('/tasks?page=' . $page);
 }