Product Star-Based Rating Column with Custom Popup

Filament 4

Ratings let you gather user feedback on how well your product is received. You can easily integrate a rating system directly into your Filament tables!

FilamentExamples ThumbBase (11)

Get the Source Code:

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/Products/Tables/ProductsTable.php:

use App\Models\Review;
use App\Models\Product;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Builder;
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ViewColumn;
 
public static function configure(Table $table): Table
{
return $table
->modifyQueryUsing(function (Builder $query) {
return $query->withCount('reviews')
// ...

Next, we will:

  • Create a custom Table Column
  • Add Action to that column
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 93 Premium Examples for $99