Skip to content

Commit fe8718b

Browse files
authored
Merge pull request #55 from devaslanphp/dev
Bug-fix: Edit comment
2 parents 2a2a195 + 6a05160 commit fe8718b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/Http/Livewire/TicketDetailsCommentsContent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ protected function getFormSchema(): array
5858
/**
5959
* Launch the update function
6060
*
61-
* @param Comment $comment
61+
* @param int $comment
6262
* @return void
6363
*/
64-
public function updateComment(Comment $comment): void
64+
public function updateComment(int $comment): void
6565
{
66-
$this->selectedComment = $comment;
66+
$this->selectedComment = Comment::where('id', $comment)->first();
6767
$this->form->fill([
68-
'content' => $comment->content
68+
'content' => $this->selectedComment->content
6969
]);
7070
$this->updating = true;
7171
}

resources/views/livewire/ticket-details-comments-content.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class="py-2 px-3 rounded-lg shadow hover:shadow-lg bg-primary-700 hover:bg-prima
3434
@endif
3535
@if($comment->owner_id === auth()->user()->id && (!$updating || $comment->id !== $selectedComment?->id))
3636
<div class="w-full flex flex-row justify-start items-center gap-5">
37-
<button type="button" wire:click="updateComment({{ $comment }})"
37+
<button type="button" wire:click="updateComment('{{ $comment->id }}')"
3838
class="text-gray-400 text-xs hover:text-primary-500 flex flex-row justify-start items-center gap-1">
3939
<i class="fa fa-pencil"></i> @lang('Edit')
4040
</button>

0 commit comments

Comments
 (0)