cfn/app/Services/Tag.php
2025-02-24 12:07:54 +08:00

23 lines
442 B
PHP
Executable File

<?php
namespace App\Services;
use App\Models\Tags;
class Tag {
public static function strToNames($sTagsStr)
{
$sTagsStr = substr($sTagsStr, 1, -1);
$aTagsId = explode('][', $sTagsStr);
$aTagsMap = Tags::all()->toArray();
foreach ($aTagsId as $aTagsIdRow) {
$aTagNames[] = $aTagsMap[$aTagsIdRow-1];
}
return $aTagNames;
}
}