use Illuminate\Database\Eloquent\Model;
<script type="application/ld+json">
protected $casts = [ 'images' => 'array', 'replies' => 'array', 'is_verified_purchase' => 'boolean', 'is_approved' => 'boolean', ]; portatour reviews
public function user()
$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') ]; protected $casts = [ 'images' =>