Skip to content

Latest commit

 

History

History
67 lines (43 loc) · 1.21 KB

7_visits-lists.md

File metadata and controls

67 lines (43 loc) · 1.21 KB

Visits Lists

Top or Lowest list per model type

Top/Lowest visited items per model

visits('App\Post')->top(10);
visits('App\Post')->low(10);

Top or Lowest list ids

Top/Lowest visited items Ids

visits('App\Post')->topIds(10);
visits('App\Post')->lowIds(10);

Filter by model attributes

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]);

Uncached list

visits('App\Post')->fresh()->top(10);

Note: you can always get uncached list by enabling alwaysFresh from config/visits.php file.

By a period of time

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 >