Top or Lowest list per model type
visits('App\Post')->top(10);
visits('App\Post')->low(10);
Top or Lowest list ids
visits('App\Post')->topIds(10);
visits('App\Post')->lowIds(10);
You can get only some of the top/low models by query where clause. For example if Post model has shares
& likes
attributes you can filter the models like this:
visits('App\Post')->top(10, [['likes', '>', 30], ['shares', '<', 20]]);
or just ...
visits('App\Post')->top(10, ['likes' => 20]);
visits('App\Post')->fresh()->top(10);
Note: you can always get uncached list by enabling
alwaysFresh
from config/visits.php file.
visits('App\Post')->period('month')->top(10);
Note supported periods can be found in periods-options
Prev: < Retrieve visits and stats
Next: Clear and reset values >