public function download($id)
 {
     $entry = \App\Models\OrgDoc::where('id', $id)->firstOrFail();
     $filepath = storage_path() . '/app' . '/organizations/' . $entry->organization_id . '/orgDocs/' . $entry->filename;
     return response()->download($filepath, $entry->original_filename);
 }
 public function postOrgDocUpload(Request $request, $id)
 {
     if ($request->file('OrgDoc')->isValid()) {
         $start_year = 2016;
         $max_year = \App\Models\OrgDoc::where('organization_id', $id)->max('year');
         if (isset($max_year)) {
             $year = ++$max_year;
         } else {
             $year = $start_year;
         }
         $file = $request->file('OrgDoc');
         $extension = $file->getClientOriginalExtension();
         Storage::disk('local')->put('/organizations/' . $id . '/orgDocs/' . $file->getFilename() . '.' . $extension, File::get($file));
         $document = new \App\Models\OrgDoc();
         $document->organization_id = $id;
         $document->year = $year;
         $document->mime = $file->getClientMimeType();
         $document->original_filename = $file->getClientOriginalName();
         $document->filename = $file->getFilename() . '.' . $extension;
         $document->save();
         return redirect()->back();
     } else {
         return redirect()->back();
     }
 }