Files
hatame.andarza09/app/Http/Controllers/CommentController.php
T
hatame 14684d5537 git add .
git commit "create admin panel layout structure"
2026-08-18 09:04:00 +03:30

41 lines
920 B
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Requests\CommentStoreRequest;
use App\Models\Comment;
use Illuminate\Support\Facades\Auth;
class CommentController extends Controller
{
public function index()
{
$comments=Comment::query()
->where('user_id',auth()->id())
->with('tour')
->latest()
->paginate(4);
return view('account.users.comments.index', [
'comments' => $comments,
'withoutHero' => true
]);
}
public function store(CommentStoreRequest $request)
{
$data = $request->validated();
$data['user_id'] = auth()->id();
$data['status'] = 0;
Comment::create($data);
return back()->with(
'success',
'نظر شما با موفقیت ثبت شد و پس از بررسی نمایش داده می‌شود.'
);
}
}