本文整理汇总了PHP中Illuminate\Support\Facades\Response::download方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::download方法的具体用法?PHP Response::download怎么用?PHP Response::download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Response
的用法示例。
在下文中一共展示了Response::download方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$sheet = new CreateExcelSheet();
$fileName = $sheet->createSheetFromTemp($request);
Flash::success('messages.success.created');
return Response::download(storage_path('invoices' . '/' . $fileName . '.xls'));
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\CreateQuotation $request)
{
$newQuotation = new CreateDocument();
$request->merge(['ref' => Carbon::now()->format('y-m-d')]);
$fileName = $newQuotation->CreateFromTemp($request);
Flash::success('messages.success.created');
return Response::download(storage_path('quotations' . '/' . $fileName . '.docx'));
}
示例3: exportDB
public function exportDB()
{
Artisan::call('db:backup', ['--database' => 'mysql', '--destination' => 'local', '--destinationPath' => '\\dbBck\\sqlBck', '--compression' => 'null']);
$file = storage_path('app') . "/dbBck/sqlBck";
//$fileName = Crypt::encrypt(rand(11111,99999)).'DB_Backup.sql';
$fileName = uniqid(Carbon::now() . 'DB_Backup') . '.sql';
$headers = array('Content-Type: application/sql');
return Response::download($file, $fileName, $headers)->deleteFileAfterSend(true);
}
示例4: getPicture
public function getPicture($user)
{
if ($user->profile && $user->profile->picture) {
return Response::download(storage_path('app/' . $user->profile->picture->filePath()));
}
if ($user->facebookUser) {
return Response::make(file_get_contents('https://graph.facebook.com/' . $user->facebookUser->id . '/picture?type=large'))->header('Content-Type', 'image/jpeg');
}
return Response::download(storage_path('app/no_image.jpg'));
}
示例5: index
public function index()
{
if (Input::get('l')) {
LaravelLogViewer::setFile(base64_decode(Input::get('l')));
}
if (Input::get('dl')) {
return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
}
$logs = LaravelLogViewer::all();
return View::make('laravel-log-viewer::log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
}
示例6: export
public function export()
{
$slug = Input::get('slug');
$fields = Input::get('fields', []);
$models = Config::get('dashboard::models');
if (!array_key_exists($slug, $models)) {
throw new NotFoundHttpException('Model not found');
}
$model = $models[$slug];
$data = $model['model']::select($fields)->get()->toArray();
$path = Backup::csv("dashboard_{$slug}", $data, $fields);
return Response::download($path);
}
示例7: index
/**
* Show the profile for the given user.
*
* @param Request $req
* @return Response
*/
public function index()
{
$name = '';
if (isset($_POST)) {
$Theme = new Theme($_POST);
$name = $Theme->createTheme();
if (strlen($name) > 0) {
$file = public_path() . '/' . $name;
$headers = array('Content-Type: application/zip');
return Response::download($file, $name, $headers);
}
}
return view('dashboard.index', ['data' => $name]);
}
示例8: index
public function index()
{
if (Input::get('l')) {
LaravelLogViewer::setFile(base64_decode(Input::get('l')));
}
if (Input::get('dl')) {
return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
} elseif (Input::has('del')) {
File::delete(storage_path() . '/logs/' . base64_decode(Input::get('del')));
return Redirect::to(Request::url());
}
$logs = LaravelLogViewer::all();
return View::make('log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
}
示例9: file
/**
* Returns a file in the assets directory
*
* @return \Illuminate\Support\Facades\Response
*/
public function file($path)
{
$file = Asset::getFullPath($path);
if (Asset::isJavascript($path)) {
return $this->javascript($path);
}
if (Asset::isStylesheet($path)) {
return $this->stylesheet($path);
}
if (file_exists($file)) {
return Response::download($file);
}
App::abort(404);
}
示例10: archive
public function archive($owner, $project, $format, $branch)
{
$repository = $project->getRepository();
$tree = $repository->getBranchTree($branch);
if (false === $tree) {
throw new HttpException(401);
}
$file = config('gitamin.cache_archives') . DIRECTORY_SEPARATOR . $project . DIRECTORY_SEPARATOR . substr($tree, 0, 2) . DIRECTORY_SEPARATOR . substr($tree, 2) . '.' . $format;
if (!file_exists($file)) {
$repository->createArchive($tree, $file, $format);
}
$filename = strtolower($project . '_' . $branch);
$filename = preg_replace('#[^a-z0-9]+#', '_', $filename);
$filename = $filename . '.' . $format;
return Response::download($file, $filename);
}
示例11: index
public function index()
{
if (Request::input('l')) {
LaravelLogViewer::setFile(base64_decode(Request::input('l')));
}
if (Request::input('dl')) {
Log::notice('perm.log.site.download - SiteLog downloaded', ['user_id' => Request::user()->user_id]);
return Response::download(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('dl'))));
} elseif (Request::has('del')) {
File::delete(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('del'))));
Log::notice('perm.log.site.delete - SiteLog deleted', ['user_id' => Request::user()->user_id]);
return Redirect::to(Request::url());
}
$logs = LaravelLogViewer::all();
Log::notice('perm.log.site.view - SiteLog opened', ['user_id' => Request::user()->user_id]);
return View::make('laravel-log-viewer::log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
}
示例12: download
public function download()
{
$assets = AssetFacade::find($this->request->input('assets'));
if (count($assets) === 1) {
return Response::download($assets[0]->getFilename(), $assets[0]->getOriginalFilename());
}
$downloadFilename = rtrim($this->request->input('filename'), '.zip') . '.zip';
$filename = tempnam(sys_get_temp_dir(), 'boomcms_asset_download');
$zip = new ZipArchive();
$zip->open($filename, ZipArchive::CREATE);
foreach ($assets as $asset) {
$zip->addFile($asset->getFilename(), $asset->getOriginalFilename());
}
$zip->close();
$response = Response::make()->header('Content-type', 'application/zip')->header('Content-Disposition', "attachment; filename={$downloadFilename}")->setContent(file_get_contents($filename));
unlink($filename);
return $response;
}
示例13: getIndex
public function getIndex()
{
AssetManager::addScript('admin::default/js/datatables/jquery.dataTables.min.js');
AssetManager::addScript('admin::default/js/datatables/jquery.dataTables_bootstrap.js');
AssetManager::addScript('admin::default/js/notify-combined.min.js');
AssetManager::addStyle('admin::default/css/dataTables.bootstrap.css');
if (Input::get('l')) {
LaravelLogViewer::setFile(base64_decode(Input::get('l')));
}
if (Input::get('dl')) {
return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
} elseif (Input::has('del')) {
File::delete(storage_path() . '/logs/' . base64_decode(Input::get('del')));
return Redirect::to(Request::url());
}
$logs = LaravelLogViewer::all();
$view = View::make('an-admin::page.log-viewer', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
return Admin::view($view, trans('an-admin::lang.log-viewer.title'));
}
示例14: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($mcid_id)
{
$headers = array('Cache-Control' => 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma' => 'no-cache', 'Expires' => 'Fri, 01 Jan 1990 00:00:00 GMT');
$mcid_id = str_replace('.png', '', $mcid_id);
// dd($mcid_id);
$mcid = MCID::where('mcid', $mcid_id)->first();
if ($mcid != null && !$mcid->genuine) {
$file = $this->manager->fileDetails($mcid->skin->url);
return Response::download(public_path() . config('site.uploads.webpath') . $file['fullPath'], null, $headers)->setContentDisposition('inline');
} else {
$skin = $this->get_skin($mcid_id);
$im = imagecreatefromstring($skin);
//ブレンドモードを無効にする
imagealphablending($im, false);
imagesavealpha($im, true);
// start buffering
ob_start();
imagepng($im);
imagedestroy($im);
$contents = ob_get_contents();
ob_end_clean();
return Response::make($contents, 200, $headers)->header('Content-Type', 'image/png');
}
}
示例15: utilStreamFile
private function utilStreamFile($headers, $filePath)
{
if (!file_exists($filePath)) {
return false;
}
$mimeType = $this->getMimeType($filePath);
// Set the appropriate mime type
$headers['Content-Type'] = $mimeType;
// Make sure this is not cached
$headers['Cache-Control'] = 'no-cache, no-store, must-revalidate';
$headers['Pragma'] = 'no-cache';
$headers['Expires'] = 0;
return Response::download($filePath);
}