Portatour Reviews Info

return $this->belongsTo(User::class);

// prevent duplicate helpful votes (pivot table omitted for brevity) $this->increment('helpful_count'); portatour reviews

return ( <div className="portatour-reviews"> <div className="reviews-header"> <h2>Customer Reviews</h2> <div className="rating-summary"> <span className="average">stats?.average_rating.toFixed(1)</span> <StarRating rating=stats?.average_rating /> <span>(stats?.total_reviews reviews)</span> </div> </div> return ( &lt

// POST /api/tours/tourId/reviews public function store(Request $request, $tourId) string API Endpoint: Get Reviews for a Tour (with sorting/filtering) // GET /api/tours/tourId/reviews public function index($tourId) StarRating rating=stats?.average_rating /&gt

<div className="write-review"> <h3>Write your review</h3> <StarRating rating=newReview.rating onChange=(r) => setNewReview(...newReview, rating: r) /> <input placeholder="Review title" value=newReview.title onChange=e => setNewReview(...newReview, title: e.target.value) /> <textarea placeholder="Share your experience..." value=newReview.comment onChange=e => setNewReview(...newReview, comment: e.target.value) /> <button onClick=submitReview>Submit Review</button> </div> </div> ); ;

$reviews = PortaTourReview::where('tour_id', $tourId) ->where('is_approved', true) ->with('user:id,name,avatar') ->orderBy('created_at', 'desc') ->paginate(10); // Aggregate rating breakdown $stats = [ 'average_rating' => PortaTourReview::where('tour_id', $tourId) ->where('is_approved', true) ->avg('rating'), 'total_reviews' => $reviews->total(), 'rating_counts' => PortaTourReview::where('tour_id', $tourId) ->where('is_approved', true) ->selectRaw('rating, count(*) as count') ->groupBy('rating') ->pluck('count', 'rating') ];

export default PortaTourReviews; // Admin routes Route::get('/admin/reviews/pending', [AdminReviewController::class, 'pending']); Route::patch('/admin/reviews/id/approve', [AdminReviewController::class, 'approve']); Route::delete('/admin/reviews/id', [AdminReviewController::class, 'destroy']); Admin view filters unapproved reviews, can approve, delete, or reply. 5. SEO & Schema.org Markup Add to tour page:

Previous
Previous

Green Mini Bunt Cakes

Next
Next

Ranch Dip