Files
hatame.andarza09/app/Http/Controllers/CommentController.php
T
hatame 78a3b1d63d git add .
git commit "Add admin management search sort and permission structure preparation"
2026-08-18 12:56:32 +03:30

40 lines
898 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()
{
$withoutHero=true;
$comments=Comment::query()
->where('user_id',auth()->id())
->with('tour')
->latest()
->paginate(4);
return view('account.users.comments.index',compact('withoutHero','comments'));
}
public function store(CommentStoreRequest $request)
{
$data = $request->validated();
$data['user_id'] = auth()->id();
$data['status'] = 0;
Comment::create($data);
return back()->with(
'success',
'نظر شما با موفقیت ثبت شد و پس از بررسی نمایش داده می‌شود.'
);
}
}