Files
ABSDEV/Modules/News/Http/Controllers/PublicNewsController.php
T
2026-07-24 14:59:44 +01:00

21 lines
598 B
PHP

<?php
namespace Modules\News\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Modules\News\Models\News;
final class PublicNewsController extends Controller
{
public function index(): View
{
return view('news::public.index', ['records' => News::published()->with(['author', 'category'])->latest('published_at')->paginate(12)]);
}
public function show(string $slug): View
{
return view('news::public.show', ['record' => News::published()->with(['author', 'category', 'tags'])->where('slug', $slug)->firstOrFail()]);
}
}