|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Services;
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Models\Article;
|
|
use App\Models\Article;
|
|
|
|
|
+use App\Models\ArticleCollection;
|
|
|
|
|
|
|
|
class ArticleService
|
|
class ArticleService
|
|
|
{
|
|
{
|
|
@@ -37,4 +38,12 @@ class ArticleService
|
|
|
|
|
|
|
|
return $matches[1] ?? [];
|
|
return $matches[1] ?? [];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function articlesInAnthology($anthologyId)
|
|
|
|
|
+ {
|
|
|
|
|
+ $inCollection = ArticleCollection::where('collect_id', $anthologyId)
|
|
|
|
|
+ ->select('article_id')
|
|
|
|
|
+ ->get()->toArray();
|
|
|
|
|
+ return array_map(fn($item) => $item['article_id'], $inCollection);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|