The code example below will return "Post" model that has greater than 6 comments.
<?php # Posts hasMany Comments $posts = Post::has('comments', '>', 6)->get();
Laravel get model based on the total number of relationship
Created on Aug 02, 2021
•134 views
<?php # Posts hasMany Comments $posts = Post::has('comments', '>', 6)->get();
If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️
Load comments for Laravel Get Total Relationship Count
Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.
View Components1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago