Skip to content

Instantly share code, notes, and snippets.

@michaelaguiar
Created October 22, 2019 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelaguiar/75bc8339dcc8df157373ce06177b15f2 to your computer and use it in GitHub Desktop.
Save michaelaguiar/75bc8339dcc8df157373ce06177b15f2 to your computer and use it in GitHub Desktop.
Laravel validate before downloading private file
<?php
public function downloadFile(Request $request)
{
// !VALIDATE USER HAS ACCESS
// Get response and clean before return
$response = Storage::download(FILE_PATH_HERE);
ob_end_clean();
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment