Skip to content

Commit

Permalink
👍 Taxonomy view actions
Browse files Browse the repository at this point in the history
  • Loading branch information
juzaweb committed May 11, 2024
1 parent c5e93f8 commit 1f587b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion modules/Backend/Models/Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ class Taxonomy extends Model
*/
public static function selectFrontendBuilder(): Builder
{
return self::query();
return apply_filters('taxonomy.selectFrontendBuilder', self::with(self::frontendSelectWith()));
}

public static function frontendSelectWith(): array
{
return apply_filters('taxonomy.withFrontendDefaults', []);
}

/**
Expand Down
7 changes: 5 additions & 2 deletions modules/Frontend/Http/Controllers/TaxonomyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Juzaweb\Backend\Http\Resources\PostResourceCollection;
use Juzaweb\Backend\Http\Resources\TaxonomyResource;
use Juzaweb\Backend\Repositories\PostRepository;
use Juzaweb\Backend\Repositories\TaxonomyRepository;
use Juzaweb\CMS\Facades\Facades;
Expand All @@ -31,7 +30,11 @@ public function index(...$slug): string|\Inertia\Response

abort_unless($taxSlug, 404);

$taxonomy = $this->taxonomyRepository->findBySlug($taxSlug);
$taxonomy = apply_filters(
'frontend.getTaxonomyBySlug',
$this->taxonomyRepository->frontendDetail($taxSlug),
$slug
);

abort_if($taxonomy === null, 404);

Expand Down

0 comments on commit 1f587b3

Please sign in to comment.