Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 1.04 KB

8_clear-and-reset-values.md

File metadata and controls

73 lines (53 loc) · 1.04 KB

Clear and reset values

Clear an item's visits

visits($post)->reset();

Clear an item's visits of a specific period

visits($post)->period('year')->reset();

Periods options

  • minute
  • hour
  • 1hours to 12hours
  • day
  • week
  • month
  • year
  • quarter
  • decade
  • century

You can also make your custom period by adding a carbon marco in AppServiceProvider:

Carbon::macro('endOf...', function () {
    //
});

Clear recorded visitors' IPs

//all
visits($post)->reset('ips');
//one
visits($post)->reset('ips','127.0.0.1');

Clear items and its visits of a given model

visits('App\Post')->reset();

Clear all cached top/lowest lists

visits('App\Post')->reset('lists');

Clear visits from all items of the given model of a period

visits('App\Post')->period('year')->reset();

Clear & reset everything!

visits('App\Post')->reset('factory');

Prev: < Visits-lists