1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Inline downloads for file resources

This commit is contained in:
David Bomba 2021-09-27 08:03:11 +10:00
parent ee947ad6c6
commit f35ad6a5a3
3 changed files with 10 additions and 16 deletions

View File

@ -20,10 +20,10 @@ use Illuminate\Database\Eloquent\Builder;
class DocumentFilters extends QueryFilters
{
public function client_id(int $client_id) :Builder
{
return $this->builder->where('client_id', $client_id);
}
// public function client_id(int $client_id) :Builder
// {
// return $this->builder->where('client_id', $client_id);
// }
/**
* Filter based on search text.

View File

@ -57,7 +57,12 @@ class DocumentController extends Controller
{
$document = Document::where('hash', $document_hash)->firstOrFail();
return Storage::disk($document->disk)->download($document->url, $document->name);
$headers = [];
if(request()->input('inline') == 'true')
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
return Storage::disk($document->disk)->download($document->url, $document->name, $headers);
}
public function downloadMultiple(DownloadMultipleDocumentsRequest $request)

View File

@ -43,37 +43,26 @@ class GatewayType extends StaticModel
switch ($type) {
case self::CREDIT_CARD:
return ctrans('texts.credit_card');
break;
case self::BANK_TRANSFER:
return ctrans('texts.bank_transfer');
break;
case self::PAYPAL:
return ctrans('texts.paypal');
break;
case self::CRYPTO:
return ctrans('texts.crypto');
break;
case self::CUSTOM:
return ctrans('texts.custom');
break;
case self::ALIPAY:
return ctrans('texts.alipay');
break;
case self::SOFORT:
return ctrans('texts.sofort');
break;
case self::APPLE_PAY:
return ctrans('texts.apple_pay');
break;
case self::SEPA:
return ctrans('texts.sepa');
break;
case self::KBC:
return ctrans('texts.kbc_cbc');
break;
case self::BANCONTACT:
return ctrans('texts.bancontact');
break;
default:
return 'Undefined.';