Product Star-Based Rating with Custom Popup
Filament 3Ratings help your product collect information on how well things are received by users. And it is completely possible to build a rating system into the table!
Get the Source Code:
Only This Example
One-time payment
Sign in with GitHub to buy
Sign in first, then complete your $9 checkout.
FilamentExamples Membership
30-day money-back guarantee
How it works
We have a Product model, which we show in the table, and a Review model, where we save the star rating and review comments.
We use the mokhosh/filament-rating Filament plugin to add a star rating.
The table can be found in ProductResource. First, to show the number of reviews, we modify the query to load the number of reviews relationships. Then, we add another select to get users' ratings for the product.
app/Filament/Resources/ProductResource.php:
use Illuminate\Database\Eloquent\Builder; public static function table(Table $table): Table{ return $table ->modifyQueryUsing(function (Builder $query) { return $query->withCount('reviews') // ...