diff --git a/app/Http/Controllers/RateCardController.php b/app/Http/Controllers/RateCardController.php index fad71d8..321ca18 100644 --- a/app/Http/Controllers/RateCardController.php +++ b/app/Http/Controllers/RateCardController.php @@ -131,6 +131,8 @@ class RateCardController extends Controller 'content_showcase.*.name' => 'required_with:content_showcase|string|max:255', 'content_showcase.*.url' => 'nullable|url', 'content_showcase.*.thumbnail_path' => 'nullable|string', + 'content_showcase.*.show_on_public' => 'nullable', + 'content_showcase.*.show_on_pdf' => 'nullable', ]); $profile = RateCardProfile::getSingleton(); @@ -141,7 +143,12 @@ class RateCardController extends Controller } $validated['show_prices'] = $request->has('show_prices'); - $validated['content_showcase'] = $request->input('content_showcase', []); + $contentShowcase = $request->input('content_showcase', []); + foreach ($contentShowcase as &$item) { + $item['show_on_public'] = filter_var($item['show_on_public'] ?? true, FILTER_VALIDATE_BOOLEAN); + $item['show_on_pdf'] = filter_var($item['show_on_pdf'] ?? true, FILTER_VALIDATE_BOOLEAN); + } + $validated['content_showcase'] = $contentShowcase; unset($validated['logo']); $profile->update($validated); diff --git a/resources/views/rate-cards/pdf.blade.php b/resources/views/rate-cards/pdf.blade.php index 688bad5..27f3479 100644 --- a/resources/views/rate-cards/pdf.blade.php +++ b/resources/views/rate-cards/pdf.blade.php @@ -299,12 +299,17 @@ @endif - @if(!empty($profile->content_showcase)) + @php + $pdfShowcase = array_filter($profile->content_showcase ?? [], function($item) { + return !isset($item['show_on_pdf']) || $item['show_on_pdf']; + }); + @endphp + @if(!empty($pdfShowcase))