diff --git a/app/Http/Controllers/Admin/CommentsController.php b/app/Http/Controllers/Admin/CommentsController.php new file mode 100644 index 0000000..7bb9889 --- /dev/null +++ b/app/Http/Controllers/Admin/CommentsController.php @@ -0,0 +1,16 @@ +resetPage(); + } + + public function updatingUserSearch(): void + { + $this->resetPage(); + } + + public function render() + { + $comments = DB::table('comments') + ->join('users', 'comments.commenter_id', '=', 'users.id') + ->select('comments.*', 'users.username') + ->when($this->search !== '', fn ($query) => $query->where('comment', 'LIKE', "%$this->search%")) + ->when($this->userSearch !== '', fn ($query) => $query->where('username', 'LIKE', "%$this->userSearch%")) + ->paginate(12); + + return view('livewire.admin-comment-search', [ + 'comments' => $comments + ]); + } +} diff --git a/resources/views/admin/comments/index.blade.php b/resources/views/admin/comments/index.blade.php new file mode 100644 index 0000000..2d0c626 --- /dev/null +++ b/resources/views/admin/comments/index.blade.php @@ -0,0 +1,5 @@ +@extends('admin.layout') + +@section('content') + @livewire('admin-comment-search') +@endsection \ No newline at end of file diff --git a/resources/views/admin/partials/sidenav.blade.php b/resources/views/admin/partials/sidenav.blade.php index 7f3b776..dcfe0c5 100644 --- a/resources/views/admin/partials/sidenav.blade.php +++ b/resources/views/admin/partials/sidenav.blade.php @@ -19,6 +19,12 @@ Users +
| + User + + | ++ Comment + + | ++ Actions + | +
|---|---|---|
| + {{ $comment->username }} + | ++ {{ $comment->comment }} + | ++ @lang('comments::comments.delete') + + | +