public static function removeFile($id)
 {
     $file = MaterialFile::findorfail($id);
     $material = $file->materials;
     MaterialFileController::destroyFile($file->filename);
     $thumb = 'thumbs/' . pathinfo($file->filename, PATHINFO_FILENAME) . '.jpg';
     MaterialFileController::destroyFile($thumb);
     $file->delete($id);
     Session::flash('warning', 'You have successfully deleted' . $file->filename);
     return redirect()->back()->with('material', 'material');
 }
 public function getDownload($file)
 {
     return MaterialFile::download($file);
 }
Пример #3
0
 public static function get($filename)
 {
     $material_file = MaterialFile::where('filename', '=', $filename)->firstOrFail();
     $file = Storage::get($material_file->filename);
     return (new Response($file, 200))->header('Content-Type', $material_file->mime);
 }