invoiceninja/app/Helpers/GenerateUrl.php
David Bomba 43e57d0117
Fixes for self-update (#3514)
* minor fix for payment notifications

* styleci

* Limit Self updating to self hosters only
:

* Fixes for designs

* Minor fixes for self-update
2020-03-21 16:37:30 +11:00

36 lines
714 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
use App\Models\Document;
use Illuminate\Support\Facades\Storage;
/**
* Generate url for the asset.
*
* @param Document $document
* @param boolean $absolute
* @return string|null
*/
function generateUrl(Document $document, $absolute = false)
{
$url = Storage::disk($document->disk)->url($document->path);
if ($url && $absolute) {
return url($url);
}
if ($url) {
return $url;
}
return null;
}