feat: add career application support for blog authors and expand blog status workflows
This commit is contained in:
@@ -20,7 +20,7 @@ class BlogController extends Controller
|
||||
$settings = class_exists(Setting::class) ? (Setting::query()->first()) : null;
|
||||
|
||||
$query = class_exists(Blog::class)
|
||||
? Blog::with(['category', 'author'])
|
||||
? Blog::with(['category', 'author', 'careerApplication'])
|
||||
->withCount('comments')
|
||||
->published()
|
||||
: null;
|
||||
@@ -29,6 +29,9 @@ class BlogController extends Controller
|
||||
if ($query && $request->has('author') && $request->author) {
|
||||
$query = $query->where('author_id', $request->author);
|
||||
}
|
||||
if ($query && $request->has('intern') && $request->intern) {
|
||||
$query = $query->where('career_application_id', $request->intern);
|
||||
}
|
||||
|
||||
// Category filtresi
|
||||
if ($query && $request->has('category') && $request->category) {
|
||||
@@ -130,14 +133,14 @@ class BlogController extends Controller
|
||||
if (!$request->ajax()) {
|
||||
if (class_exists(Blog::class)) {
|
||||
// Karusel: Öne çıkarılan ya da en güncel 5 yazı
|
||||
$carouselPosts = Blog::with(['category', 'author'])
|
||||
$carouselPosts = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->published()
|
||||
->featured()
|
||||
->latest('published_at')
|
||||
->take(5)
|
||||
->get();
|
||||
if ($carouselPosts->isEmpty()) {
|
||||
$carouselPosts = Blog::with(['category', 'author'])
|
||||
$carouselPosts = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->published()
|
||||
->latest('published_at')
|
||||
->take(5)
|
||||
@@ -145,7 +148,7 @@ class BlogController extends Controller
|
||||
}
|
||||
|
||||
// Popüler Yazılar: En çok okunan 3 yazı
|
||||
$popularPosts = Blog::with(['category', 'author'])
|
||||
$popularPosts = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->published()
|
||||
->orderBy('view_count', 'desc')
|
||||
->take(3)
|
||||
@@ -224,14 +227,14 @@ class BlogController extends Controller
|
||||
if (!class_exists(Blog::class)) {
|
||||
abort(404);
|
||||
}
|
||||
$post = Blog::with(['category', 'author'])
|
||||
$post = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->withCount('comments')
|
||||
->published()
|
||||
->where('slug', $slug)
|
||||
->firstOrFail();
|
||||
|
||||
// İlgili blog gönderilerini al (aynı kategoriden, mevcut gönderi hariç)
|
||||
$relatedPosts = Blog::with(['category', 'author'])
|
||||
$relatedPosts = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->withCount('comments')
|
||||
->published()
|
||||
->where('id', '!=', $post->id)
|
||||
@@ -244,7 +247,7 @@ class BlogController extends Controller
|
||||
|
||||
// Eğer aynı kategoriden yeterli gönderi yoksa, diğer kategorilerden ekle
|
||||
if ($relatedPosts->count() < 4) {
|
||||
$additionalPosts = Blog::with(['category', 'author'])
|
||||
$additionalPosts = Blog::with(['category', 'author', 'careerApplication'])
|
||||
->withCount('comments')
|
||||
->published()
|
||||
->where('id', '!=', $post->id)
|
||||
|
||||
Reference in New Issue
Block a user