forked from eatvio/eatvio-infra
small style fix
This commit is contained in:
@@ -5,12 +5,12 @@ namespace App\Services\Recipe;
|
||||
use App\Livewire\Recipe\ListView;
|
||||
use App\Models\Recipe;
|
||||
use App\Services\Strategy\Criteried\AuthorCriteriaStrategy;
|
||||
use App\Services\Strategy\Criteried\CriteriaStrategy;
|
||||
use App\Services\Strategy\Criteried\DefaultCriteriaStrategy;
|
||||
use App\Services\Strategy\Criteried\SearchCriteriaStrategy;
|
||||
use App\Services\Strategy\Criteried\TagCriteriaStrategy;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use App\Services\Strategy\Criteried\CriteriaStrategy;
|
||||
|
||||
class ListViewService
|
||||
{
|
||||
@@ -28,12 +28,12 @@ class ListViewService
|
||||
return $this->getSecondaryCriteriedRecipes($recipes);
|
||||
}
|
||||
|
||||
public function getTagsCollection(): array
|
||||
public function getTagsCollection(): ?array
|
||||
{
|
||||
return Recipe::all()->map(
|
||||
fn ($r) => [
|
||||
$r->type,
|
||||
$r->tags->map(fn ($t) => $t->id . '-' . $t->name)->all(),
|
||||
$r->tags->map(fn ($t) => $t->id.'-'.$t->name)->all(),
|
||||
]
|
||||
)->reduce(function ($acc, $item) {
|
||||
[$type, $tagNames] = $item;
|
||||
@@ -44,6 +44,7 @@ class ListViewService
|
||||
$acc[$type][$name] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $acc;
|
||||
});
|
||||
}
|
||||
@@ -51,6 +52,7 @@ class ListViewService
|
||||
private function getPrimaryCriteriedRecipes(): Builder|Recipe|MorphToMany|array
|
||||
{
|
||||
$criteria = $this->getCriteriaStrategy();
|
||||
|
||||
return $criteria->getRecipes();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user