23 lines
442 B
PHP
Executable File
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;
|
|
|
|
}
|
|
|
|
}
|