news
This commit is contained in:
1 parent
6b61b51d53
commit
d9178c17f7
2 files changed
+23
-2
No files matched your search
@@ -57,4 +57,23 @@ class TagService
|
||||
return $queryBuilder->whereIn("id", $entityIdArr)->get();
|
||||
}
|
||||
|
||||
public static function getEntityByTagSlug(string $tagSlug, $model)
|
||||
{
|
||||
$tag = Tag::where("slug", $tagSlug)->first();
|
||||
if ($tag){
|
||||
$tagEntity = TagEntity::where("tag_id", $tag->id)->get();
|
||||
if ($tagEntity){
|
||||
$entityIdArr = [];
|
||||
foreach ($tagEntity as $item){
|
||||
$entityIdArr[] = $item['entity_id'];
|
||||
}
|
||||
}
|
||||
$queryBuilder = $model::query();
|
||||
|
||||
return $queryBuilder->whereIn("id", $entityIdArr)->get();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user