public static function addDownload($file_name) { if (Laralum::isDocument($file_name)) { $file = Document::where('name', $file_name)->first(); $file->downloads = $file->downloads + 1; $file->save(); } }
public static function downloadFile($file_name) { # Add a new download to the file if it's a document if (Laralum::isDocument($file_name)) { Laralum::addDownload($file_name); } return response()->download(storage_path('app/' . $file_name)); }