27 lines
680 B
PHP
27 lines
680 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Shop;
|
|
|
|
use App\Models\Shop\Article;
|
|
|
|
class Searches
|
|
{
|
|
public static function search($options)
|
|
{
|
|
// Get article IDs from Scout search
|
|
$searchResults = Article::search($options['search_name'])->get()->pluck('id');
|
|
|
|
// Filter to only include visible articles
|
|
$visibleArticleIds = Article::whereIn('id', $searchResults)->visible()->pluck('id');
|
|
|
|
return collect(Articles::getArticlesToSell([
|
|
'ids' => $visibleArticleIds,
|
|
]))->sortBy('searchOrder')->toArray();
|
|
}
|
|
|
|
public static function getResults($options)
|
|
{
|
|
return Articles::getArticlesToSell($options);
|
|
}
|
|
}
|