refactor: streamline MusicProductionController by removing unused header logic, optimizing queries, and enhancing view data structure for improved maintainability

This commit is contained in:
Ümit Tunç
2026-05-20 23:03:49 +03:00
parent e18c8bbbcf
commit ad4f04b005
4 changed files with 101 additions and 61 deletions
@@ -62,9 +62,9 @@ class MusicProductionController extends Controller
}
$meta = [
'title' => __('music_productions.meta-index-title'),
'title' => __('music_productions.nav-music-productions'),
'description' => __('music_productions.meta-index-description'),
'image' => null,
'image' => asset('assets/img/photos/about28.jpg'),
];
return view('front.music-productions.index', compact('productions', 'settings', 'renderedHeader', 'renderedFooter', 'meta'));
+3 -2
View File
@@ -3,8 +3,9 @@
return [
// Navigation & list
'nav-music-productions' => 'Music Productions',
'meta-index-title' => 'Music Productions',
'meta-index-description' => 'Our music production, soundtrack and corporate music work.',
'meta-index-subtitle' => 'Truncgil',
'meta-index-title' => 'Music production, soundtracks and corporate music projects.',
'meta-index-description' => 'Explore our albums, singles and production work published on Spotify, YouTube and digital platforms.',
'empty' => 'No music productions registered yet.',
'card_category_default' => 'Production',
'view_details_tooltip' => 'View details',
+3 -2
View File
@@ -3,8 +3,9 @@
return [
// Navigation & list
'nav-music-productions' => 'Müzik Prodüksiyonları',
'meta-index-title' => 'Müzik Prodüksiyonları',
'meta-index-description' => 'Müzik prodüksiyonu, film müzikleri ve kurumsal müzik çalışmalarımız.',
'meta-index-subtitle' => 'Truncgil',
'meta-index-title' => 'Müzik prodüksiyonu, film müzikleri ve kurumsal müzik çalışmalarımız.',
'meta-index-description' => 'Spotify, YouTube ve dijital platformlarda yayımlanan albüm, single ve prodüksiyon projelerimizi keşfedin.',
'empty' => 'Şu anda kayıtlı müzik prodüksiyonu bulunmuyor.',
'card_category_default' => 'Prodüksiyon',
'view_details_tooltip' => 'Detayları görüntüle',
@@ -1,61 +1,99 @@
@extends('layouts.site')
@section('content')
<section class="wrapper !bg-[#edf2fc]">
<div class="container !pt-10 !pb-36 xl:!pt-[4.5rem] lg:!pt-[4.5rem] md:!pt-[4.5rem] xl:!pb-40 lg:!pb-40 md:!pb-40 !text-center">
{{-- demo28.html: hero + itemgrid --}}
<section class="wrapper bg-gradient-blend">
<div class="container pt-24 xl:pt-32 lg:pt-32 md:pt-32 pb-14 md:pb-32 xl:pb-40 lg:pb-40">
<div class="flex flex-wrap mx-[-15px]">
<div class="md:w-7/12 lg:w-6/12 xl:w-5/12 w-full flex-[0_0_auto] !px-[15px] max-w-full !mx-auto">
<h1 class="!text-[calc(1.365rem_+_1.38vw)] font-bold !leading-[1.2] xl:!text-[2.4rem] !mb-3">{{ __('music_productions.meta-index-title') }}</h1>
<p class="lead lg:!px-[1.25rem] xl:!px-[1.25rem] xxl:!px-[2rem] !leading-[1.65] text-[0.9rem] font-medium">{{ __('music_productions.meta-index-description') }}</p>
<div class="xl:w-3/12 lg:w-3/12 w-full flex-[0_0_auto] !px-[15px] max-w-full !mx-auto">
<div class="img-mask mask-2">
<img src="{{ asset('assets/img/photos/about28.jpg') }}" alt="{{ __('music_productions.meta-index-title') }}">
</div>
</div>
<!-- /column -->
</div>
<!-- /.row -->
<div class="flex flex-wrap mx-[-15px] !mt-10">
<div class="md:w-10/12 lg:w-9/12 xl:w-9/12 xxl:w-8/12 w-full flex-[0_0_auto] !px-[15px] max-w-full !mx-auto !text-center">
<h2 class="!text-[0.85rem] !leading-[1.35] !tracking-[0.02rem] uppercase !text-[#aab0bc] !mb-3">{{ __('music_productions.meta-index-subtitle') }}</h2>
<h3 class="xl:!text-[2.4rem] !text-[calc(1.365rem_+_1.38vw)] font-semibold !leading-[1.15] !mb-5 xl:!px-14">{{ __('music_productions.meta-index-title') }}</h3>
<p class="lead !text-[1.1rem]">{{ __('music_productions.meta-index-description') }}</p>
</div>
<!-- /column -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
<div class="overflow-hidden">
<div class="divider !text-[#fefefe] mx-[-0.5rem]">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 92.26">
<path fill="currentColor" d="M1206,21.2c-60-5-119-36.92-291-5C772,51.11,768,48.42,708,43.13c-60-5.68-108-29.92-168-30.22-60,.3-147,27.93-207,28.23-60-.3-122-25.94-182-36.91S30,5.93,0,16.2V92.26H1440v-87l-30,5.29C1348.94,22.29,1266,26.19,1206,21.2Z" />
</svg>
</div>
</div>
<!-- /.overflow-hidden -->
</section>
<!-- /section -->
<section class="wrapper !bg-[#ffffff]">
<div class="container !pb-[4.5rem] xl:!pb-24 lg:!pb-24 md:!pb-24">
<section class="wrapper">
<div class="container pt-14 xl:pt-0 lg:pt-0 md:pt-0 pb-24 xl:pb-32 lg:pb-32 md:pb-32">
@if($productions->count() > 0)
<div class="itemgrid grid-view projects-masonry !mt-[-10rem] xl:!mt-[-12rem] lg:!mt-[-12rem] md:!mt-[-10rem] !mb-10">
<div class="itemgrid grid-view projects-masonry md:!mt-[-10rem] lg:!mt-[-15rem] xl:!mt-[-15rem] !mb-[10rem]">
<div class="flex flex-wrap mx-[-20px] xl:mx-[-25px] lg:mx-[-25px] !mt-[-2rem] xl:!mt-[-2.5rem] lg:!mt-[-2.5rem] isotope">
@php
$accentColors = [
['border' => '#54a8c7', 'text' => '#54a8c7', 'tooltip' => 'itooltip-aqua', 'filter' => 'workshop'],
['border' => '#747ed1', 'text' => '#747ed1', 'tooltip' => 'itooltip-purple', 'filter' => 'product'],
['border' => '#fab758', 'text' => '#fab758', 'tooltip' => 'itooltip-yellow', 'filter' => 'product'],
['border' => '#e2626b', 'text' => '#e2626b', 'tooltip' => 'itooltip-red', 'filter' => 'workshop'],
['border' => '#f78b77', 'text' => '#f78b77', 'tooltip' => 'itooltip-orange', 'filter' => 'still-life'],
['border' => '#7cb798', 'text' => '#7cb798', 'tooltip' => 'itooltip-leaf', 'filter' => 'concept'],
['border' => '#d16b86', 'text' => '#d16b86', 'tooltip' => 'itooltip-pink', 'filter' => 'product'],
['border' => '#45c4a0', 'text' => '#45c4a0', 'tooltip' => 'itooltip-green', 'filter' => 'workshop'],
['border' => '#a07cc5', 'text' => '#a07cc5', 'tooltip' => 'itooltip-violet', 'filter' => 'concept'],
$variants = [
[
'filter' => 'workshop',
'tooltip' => 'itooltip-aqua',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#54a8c7] !mb-2 !text-[#54a8c7]",
],
[
'filter' => 'product',
'tooltip' => 'itooltip-purple',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#747ed1] !mb-2 !text-[#747ed1]",
],
[
'filter' => 'product',
'tooltip' => 'itooltip-yellow',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#fab758] !mb-2 !text-[#fab758]",
],
[
'filter' => 'workshop',
'tooltip' => 'itooltip-red',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#e2626b] !mb-2 !text-[#e2626b]",
],
[
'filter' => 'still-life',
'tooltip' => 'itooltip-orange',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#f78b77] !mb-2 !text-[#f78b77]",
],
[
'filter' => 'product',
'tooltip' => 'itooltip-leaf',
'label_class' => "inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 before:bg-[#7cb798] !mb-2 !text-[#7cb798]",
],
];
@endphp
@foreach($productions as $index => $production)
@php
$color = $accentColors[$index % count($accentColors)];
$variant = $variants[$index % count($variants)];
$categoryLabel = $production->translate('client_name') ?: __('music_productions.card_category_default');
$detailUrl = route('music-productions.show', $production->slug);
@endphp
<div class="project item xl:w-4/12 lg:w-6/12 md:w-6/12 w-full flex-[0_0_auto] max-w-full {{ $color['filter'] }} px-[20px] xl:!px-[25px] lg:!px-[25px] !mt-[2rem] xl:!mt-[2.5rem] lg:!mt-[2.5rem]">
<div class="project item xl:w-4/12 lg:w-6/12 md:w-6/12 w-full flex-[0_0_auto] max-w-full {{ $variant['filter'] }} px-[20px] xl:!px-[25px] lg:!px-[25px] !mt-[2rem] xl:!mt-[2.5rem] lg:!mt-[2.5rem]">
<div class="card !shadow-[0_0.25rem_1.75rem_rgba(30,34,40,0.07)]">
<figure class="card-img-top itooltip {{ $color['tooltip'] }}" title='<h5 class="!mb-0">{{ e(__('music_productions.view_details_tooltip')) }}</h5>'>
<figure class="card-img-top itooltip {{ $variant['tooltip'] }}" title='<h5 class="!mb-0">{{ e(__('music_productions.view_details_tooltip')) }}</h5>'>
<a href="{{ $detailUrl }}">
@if($production->cover_image_url)
<img src="{{ $production->cover_image_url }}" alt="{{ $production->translate('title') }}">
@else
<div class="bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center" style="height: 250px;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-16 h-16 text-gray-400">
<path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
</svg>
</div>
<img src="{{ asset('assets/img/photos/pd6.jpg') }}" alt="{{ $production->translate('title') }}">
@endif
</a>
</figure>
<div class="card-body p-7">
<div class="post-header">
<div class="inline-flex uppercase !tracking-[0.02rem] text-[0.7rem] font-semibold text-line relative align-top !pl-[1.4rem] before:content-[''] before:absolute before:inline-block before:translate-y-[-60%] before:w-3 before:h-[0.05rem] before:left-0 before:top-2/4 !mb-2" style="color: {{ $color['text'] }};">
{{ $categoryLabel }}
</div>
<div class="{{ $variant['label_class'] }}">{{ $categoryLabel }}</div>
<h3 class="!mb-0">{{ $production->translate('title') }}</h3>
</div>
<!-- /.post-header -->
@@ -67,40 +105,42 @@
<!-- /.project -->
@endforeach
</div>
<!-- /.isotope -->
<!-- /.row -->
</div>
<!-- /.itemgrid -->
<!-- /.grid -->
{{-- Pagination --}}
@if($productions->hasPages())
<div class="flex justify-center !mt-8">
<nav class="pagination-wrapper">
{{ $productions->links() }}
</nav>
<div class="flex flex-wrap mx-[-15px] !mt-[-4rem]">
<div class="w-full flex-[0_0_auto] !px-[15px] max-w-full">
<nav class="pagination-wrapper flex justify-center">
{{ $productions->links() }}
</nav>
</div>
</div>
@endif
@else
<div class="!mt-[-8rem] !mb-10 text-center">
<div class="card !shadow-[0_0.25rem_1.75rem_rgba(30,34,40,0.07)] !p-12">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-16 h-16 text-gray-300 mx-auto !mb-4">
<path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
</svg>
<p class="text-[#aab0bc] text-lg">{{ __('music_productions.empty') }}</p>
<div class="itemgrid grid-view projects-masonry md:!mt-[-10rem] lg:!mt-[-15rem] xl:!mt-[-15rem]">
<div class="flex flex-wrap mx-[-15px]">
<div class="w-full flex-[0_0_auto] !px-[15px] max-w-full !text-center">
<div class="card !shadow-[0_0.25rem_1.75rem_rgba(30,34,40,0.07)] !p-12">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-16 h-16 text-gray-300 mx-auto !mb-4">
<path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
</svg>
<p class="text-[#aab0bc] text-lg">{{ __('music_productions.empty') }}</p>
</div>
</div>
</div>
</div>
@endif
</div>
<!-- /.container -->
</section>
<!-- /section -->
@endsection
@push('styles')
<style>
/* Accent line color for category labels */
.text-line::before {
background-color: currentColor !important;
}
/* Custom pagination styling */
.pagination-wrapper .pagination {
display: flex;
gap: 0.35rem;
@@ -129,23 +169,21 @@
text-decoration: none;
}
.pagination-wrapper .pagination li a:hover {
background: #e31e24;
border-color: #e31e24;
background: #747ed1;
border-color: #747ed1;
color: #fff;
transform: translateY(-0.1rem);
box-shadow: 0 0.25rem 0.75rem rgba(227,30,36,0.25);
box-shadow: 0 0.25rem 0.75rem rgba(116, 126, 209, 0.25);
}
.pagination-wrapper .pagination li.active span,
.pagination-wrapper .pagination li span[aria-current="page"] {
background: #e31e24;
border-color: #e31e24;
background: #747ed1;
border-color: #747ed1;
color: #fff;
}
.pagination-wrapper .pagination li.disabled span {
opacity: 0.5;
cursor: not-allowed;
}
</style>
@endpush
@endsection