14684d5537
git commit "create admin panel layout structure"
41 lines
920 B
PHP
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',
|
|
'نظر شما با موفقیت ثبت شد و پس از بررسی نمایش داده میشود.'
|
|
);
|
|
|
|
}
|
|
}
|