27 lines
724 B
PHP
27 lines
724 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Channel;
|
|
use App\Models\Publication;
|
|
use App\Models\TaxonomyTerm;
|
|
use Illuminate\Http\Response;
|
|
|
|
class TaxonomyController extends Controller
|
|
{
|
|
public function show(Channel $channel, string $slug): Response
|
|
{
|
|
$term = TaxonomyTerm::where('channel_id', $channel->id)
|
|
->where('slug', $slug)
|
|
->firstOrFail();
|
|
|
|
$publications = $term->publications()
|
|
->published()
|
|
->forChannel($channel)
|
|
->with(['post.author', 'taxonomyTerms'])
|
|
->latest('published_at')
|
|
->paginate(12);
|
|
|
|
return response()->view('theme::taxonomy.show', compact('term', 'publications'));
|
|
}
|
|
}
|