mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
69fa60b91c
* Added generateUrl method for getting assets * Fix return types
32 lines
682 B
PHP
32 lines
682 B
PHP
<?php
|
|
|
|
use App\Models\Document;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
/**
|
|
* 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;
|
|
} |