示例#1
0
 /**
  * Create a new file Download Response.
  *
  * @param  \SplFileInfo|string  $file
  * @param  string  $name
  * @param  array   $headers
  * @param  null|string  $disposition
  * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
  */
 public static function download($file, $name = null, array $headers = array(), $disposition = 'attachment')
 {
     $response = new BinaryFileResponse($file, 200, $headers, true, $disposition);
     if (!is_null($name)) {
         return $response->setContentDisposition($disposition, $name, Str::ascii($name));
     }
     return $response;
 }