diff --git a/app/Http/Controllers/admin/CommentController.php b/app/Http/Controllers/admin/CommentController.php index 3a8ce24..47d76bf 100644 --- a/app/Http/Controllers/admin/CommentController.php +++ b/app/Http/Controllers/admin/CommentController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; +use App\Http\Requests\CommentUpdateRequest; use App\Http\Requests\UpdateCommentRequest; use App\Models\Comment; @@ -22,12 +23,12 @@ class CommentController extends Controller return view('admin.comments.show', compact('comment')); } - public function edit(Comment $comment) - { - return view('admin.comments.edit', compact('comment')); - } +// public function edit(Comment $comment) +// { +// return view('admin.comments.edit', compact('comment')); +// } - public function update(UpdateCommentRequest $request, Comment $comment) + public function update(CommentUpdateRequest $request, Comment $comment) { $comment->update($request->validated()); diff --git a/app/Http/Requests/CommentUpdateRequest.php b/app/Http/Requests/CommentUpdateRequest.php index 5d3a211..7f1c651 100644 --- a/app/Http/Requests/CommentUpdateRequest.php +++ b/app/Http/Requests/CommentUpdateRequest.php @@ -27,7 +27,9 @@ class CommentUpdateRequest extends FormRequest 'body' => [ 'required', - 'string' + 'string', + 'min:3', + 'max:1000' ], 'status' => [ diff --git a/resources/views/admin/comments/edit.blade.php b/resources/views/admin/comments/edit.blade.php deleted file mode 100644 index 9d6f483..0000000 --- a/resources/views/admin/comments/edit.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
| # | +کاربر | +مرتبط با | +متن نظر | +وضعیت | +تاریخ | +عملیات | +
|---|---|---|---|---|---|---|
| {{ $comments->firstItem() + $loop->index }} | +{{ $comment->user?->name ?? 'کاربر حذفشده' }} | ++ {{ class_basename($comment->commentable_type) }} + شناسه: {{ $comment->commentable_id }} + | ++ {{ \Illuminate\Support\Str::limit($comment->body, 60) }} + | ++ @include('admin.comments.status', ['status' => $comment->status]) + | +{{ $comment->created_at->format('Y/m/d') }} | ++ + | +
| هنوز نظری ثبت نشده است. | +||||||