We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add types of ratings (categories)
The text was updated successfully, but these errors were encountered:
I don't think any changes are necessary to this package to facilitate this.
Sorry, something went wrong.
I guess that you mean one could
Schema::table('ratings', function (Blueprint $table) { $table->string('category')->nullable(); // or use an enum if categories are predefined });
and then
$product = Product::find(1); $qualityRatings = $product->ratings()->where('category', 'quality')->get(); $priceRatings = $product->ratings()->where('category', 'price')->get();
also maybe use a separate model for categories (if needed):
// RatingCategory model class RatingCategory extends Model { public function ratings() { return $this->hasMany(Rating::class); } } // Rating model class Rating extends Model { public function category() { return $this->belongsTo(RatingCategory::class); } }
No branches or pull requests
add types of ratings (categories)
The text was updated successfully, but these errors were encountered: