Deploy Ladill Transfer / deploy (push) Successful in 28s
Add a service API for the Ladill SMS platform to store voice recordings in Transfer and charge monthly storage from the customer wallet. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
537 B
PHP
22 lines
537 B
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use App\Models\QrCode;
|
|
use App\Models\Transfer;
|
|
use App\Models\TransferFile;
|
|
use RuntimeException;
|
|
|
|
class DirectTransferFileUrl
|
|
{
|
|
public static function for(Transfer $transfer, TransferFile $file): string
|
|
{
|
|
$shortCode = $transfer->qrCode?->short_code;
|
|
if ($shortCode === null || $shortCode === '') {
|
|
throw new RuntimeException('Transfer file URL is unavailable.');
|
|
}
|
|
|
|
return QrCode::publicBaseUrl().'/q/'.$shortCode.'/transfer/files/'.$file->id;
|
|
}
|
|
}
|