Download core/app/Http/Controllers/Admin/CommentController.php from pnacorp/codeplus: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Http/Controllers/Admin/CommentController.php
- Command line
-
hf download hf://pnacorp/codeplus/core/app/Http/Controllers/Admin/CommentController.php
-
curl -L -o CommentController.php https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Http/Controllers/Admin/CommentController.php
1.32 kB
| namespace App\Http\Controllers\Admin; | |
| use App\Http\Controllers\Controller; | |
| use App\Models\Comment; | |
| use Illuminate\Http\Request; | |
| class CommentController extends Controller | |
| { | |
| public function index($authorId = 0) | |
| { | |
| $pageTitle = 'Comments'; | |
| $comments = Comment::where('review_id', 0)->with(['user', 'product']); | |
| if($authorId){ | |
| $comments = $comments->where('user_id', $authorId); | |
| } | |
| $comments = $comments->paginate(getPaginate()); | |
| return view('admin.comment.index', compact('pageTitle', 'comments')); | |
| } | |
| public function destroy($id) { | |
| $comment = Comment::findOrFail($id); | |
| $comment->delete(); | |
| $notify[] = ['success', 'Comment deleted']; | |
| return back()->withNotify($notify); | |
| } | |
| public function repliesList($commentId) { | |
| $pageTitle = 'Replies'; | |
| $comment = Comment::findOrFail($commentId); | |
| $replies = $comment->replies()->with(['user', 'product'])->paginate(getPaginate()); | |
| return view('admin.comment.reply.index', compact('pageTitle', 'replies')); | |
| } | |
| public function deleteReply($id) { | |
| $comment = Comment::findOrFail($id); | |
| $comment->delete(); | |
| $notify[] = ['success','Reply deleted']; | |
| return back()->withNotify($notify); | |
| } | |
| } | |