@if(app()->getLocale() === 'ar')
{{ __('navigation.popular_tags') }}
@else
{{ __('navigation.popular_tags') }}
@endif
@php
// Get popular tags from database
$popularTags = \App\Models\Blog::active()
->whereNotNull('tags')
->pluck('tags')
->map(function($tags) {
return explode(',', $tags);
})
->flatten()
->map(function($tag) {
return trim($tag);
})
->filter()
->countBy()
->sortDesc()
->take(10)
->keys()
->toArray();
// Fallback tags if no tags in database
if (empty($popularTags)) {
$popularTags = [
'Laravel' => __('Laravel'),
'Vue.js' => __('Vue.js'),
'React' => __('React'),
'Mobile' => __('Mobile'),
'Web Development' => __('Web Development'),
'AI' => __('AI'),
'Cloud' => __('Cloud'),
'Security' => __('Security')
];
}
@endphp
@foreach($popularTags as $tag)
#{{ $tag }}
@endforeach