blog
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Article;
|
||||
|
||||
class BlogController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$articles = Article::published()
|
||||
->orderByDesc('published_at')
|
||||
->paginate(12);
|
||||
|
||||
return view('blog.index', compact('articles'));
|
||||
}
|
||||
|
||||
public function show(Article $article)
|
||||
{
|
||||
abort_unless($article->is_published, 404);
|
||||
|
||||
return view('blog.show', compact('article'));
|
||||
}
|
||||
}
|
||||
@@ -66,11 +66,26 @@ class SitemapController extends Controller
|
||||
{
|
||||
$xml = $this->cacheService->remember(
|
||||
'sitemap:jobs',
|
||||
1800, // 30 minutes cache (jobs change more frequently)
|
||||
1800,
|
||||
fn() => $this->sitemapService->generateJobsSitemap()
|
||||
);
|
||||
|
||||
return response($xml, 200)
|
||||
->header('Content-Type', 'application/xml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and serve blog sitemap
|
||||
*/
|
||||
public function blogSitemap(): Response
|
||||
{
|
||||
$xml = $this->cacheService->remember(
|
||||
'sitemap:blog',
|
||||
3600,
|
||||
fn() => $this->sitemapService->generateBlogSitemap()
|
||||
);
|
||||
|
||||
return response($xml, 200)
|
||||
->header('Content-Type', 'application/xml');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user