UncleBen
UncleBen
FFilament
Created by UncleBen on 10/26/2023 in #❓┊help
Display count of relationship in table column where pivot value = something
Hi, I need to access the many to many relationship of a model in a column and display the count of the relationship where a pivot value equals a certain value. How can I go about this? The eloquent query for this would be $model->relationship()->wherePivot('status', 'active')->count(); I just can't work out how to do this using the documentation. Or is this something I should just add to the laravel model using a getAttribute method? Thanks,
4 replies