From e82372d5c7d8fe320fc37ae461123554fba4ec0a Mon Sep 17 00:00:00 2001 From: A1Gard Date: Wed, 13 Nov 2024 06:37:46 +0330 Subject: [PATCH] fixed comments send bugs --- app/Http/Controllers/ClientController.php | 10 +++++++--- resources/views/client/default-list.blade.php | 2 +- resources/views/client/gallery.blade.php | 2 +- resources/views/client/post.blade.php | 2 +- resources/views/client/product.blade.php | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 5962fb7..e65751c 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -92,7 +92,8 @@ class ClientController extends Controller __('Video clips') => clipsUrl(), $clip->title => null, ]; - return view('client.default-list', compact('area', 'clip', 'title', 'subtitle', 'breadcrumb')); + $model = $clip; + return view('client.default-list', compact('area', 'clip', 'title', 'subtitle', 'breadcrumb','model')); } public function gallery($slug) @@ -175,7 +176,8 @@ class ClientController extends Controller __('Attachments') => attachmentsUrl(), $attachment->title => null, ]; - return view('client.default-list', compact('area', 'attachment', 'title', 'subtitle', 'breadcrumb')); + $model = $attachment; + return view('client.default-list', compact('area', 'attachment', 'title', 'subtitle', 'breadcrumb','model')); } public function tag($slug) @@ -221,7 +223,9 @@ class ClientController extends Controller } } - $comment->parent_id = $request->input('parent_id', null); + if ($request->input('parent_id') != '') { + $comment->parent_id = $request->input('parent_id', null); + } $comment->body = $request->input('message'); $comment->commentable_type = $request->input('commentable_type'); $comment->commentable_id = $request->input('commentable_id'); diff --git a/resources/views/client/default-list.blade.php b/resources/views/client/default-list.blade.php index b4f2500..8995ba4 100644 --- a/resources/views/client/default-list.blade.php +++ b/resources/views/client/default-list.blade.php @@ -12,7 +12,7 @@ @endforeach @endif @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) + @php($p = $part->getBladeWithData($model??null)) @include($p['blade'],['data' => $p['data']]) @endforeach @if(findArea($area)->use_default) diff --git a/resources/views/client/gallery.blade.php b/resources/views/client/gallery.blade.php index 43f7a64..c9144db 100644 --- a/resources/views/client/gallery.blade.php +++ b/resources/views/client/gallery.blade.php @@ -12,7 +12,7 @@ @endforeach @endif @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) + @php($p = $part->getBladeWithData($gallery)) @include($p['blade'],['data' => $p['data']]) @endforeach @if(findArea($area)->use_default) diff --git a/resources/views/client/post.blade.php b/resources/views/client/post.blade.php index 13cd00c..c579694 100644 --- a/resources/views/client/post.blade.php +++ b/resources/views/client/post.blade.php @@ -11,7 +11,7 @@ @endforeach @endif @foreach(getParts($area,$post) as $part) - @php($p = $part->getBladeWithData()) + @php($p = $part->getBladeWithData($post)) @include($p['blade'],['data' => $p['data']]) @endforeach @if(findArea($area,$post)->use_default) diff --git a/resources/views/client/product.blade.php b/resources/views/client/product.blade.php index de4f0a0..c60dc0a 100644 --- a/resources/views/client/product.blade.php +++ b/resources/views/client/product.blade.php @@ -12,7 +12,7 @@ @endforeach @endif @foreach(getParts($area,$product) as $part) - @php($p = $part->getBladeWithData()) + @php($p = $part->getBladeWithData($product)) @include($p['blade'],['data' => $p['data']]) @endforeach @if(findArea($area,$product)->use_default)