Files
many-notes/app/Actions/GetUrlFromVaultNode.php
2025-01-26 19:54:29 +00:00

23 lines
492 B
PHP

<?php
declare(strict_types=1);
namespace App\Actions;
use App\Models\VaultNode;
final class GetUrlFromVaultNode
{
public function handle(VaultNode $node): string
{
/**
* @var string $fullPath
*
* @phpstan-ignore-next-line larastan.noUnnecessaryCollectionCall
*/
$fullPath = $node->ancestorsAndSelf()->get()->last()->full_path;
return '/files/' . $node->vault_id . '?path=' . $fullPath . '.' . $node->extension;
}
}