File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 2222 - [ Views] ( #visit-monitoring-views )
2323 - [ Ajax Requests] ( #ajax-requests )
2424 - [ Visit Monitoring Guest Mode] ( #visit-monitoring-guest-mode )
25+ - [ Visit Monitoring Custom Conditions] ( #visit-monitoring-custom-conditions )
2526 - [ Action Monitoring] ( #action-monitoring )
2627 - [ Views] ( #action-monitoring-views )
2728 - [ Reverse Proxy Config] ( #action-monitoring-reverse-proxy-config )
@@ -366,6 +367,34 @@ When set to `false`, only authenticated user visits will be recorded.
366367],
367368```
368369
370+ <a name =" visit-monitoring-custom-conditions " ></a >
371+ ### Visit Monitoring Custom Conditions
372+
373+ The ` Laravel User Monitoring ` package allows you to define custom conditions for visit monitoring.
374+ Conditions give you full control over when a visit should be logged.
375+
376+ #### 🔧 How It Works
377+
378+ - Conditions are checked before a visit is stored.
379+ - If any condition returns false, the visit will be skipped.
380+ - You can define conditions as closures or as class-based rules.
381+
382+ ``` php
383+ 'visit_monitoring' => [
384+ 'conditions' => [
385+ // Class-based condition (must implement MonitoringCondition interface)
386+ \App\Monitoring\YourCustomCondition::class,
387+
388+ // Closure-based condition (receives the Request and authenticated User)
389+ function (Illuminate\Http\Request $request) {
390+ $user = $request->user();
391+
392+ return $user && $user->isAdmin();
393+ },
394+ ],
395+ ],
396+ ```
397+
369398<a name =" action-monitoring " ></a >
370399## Action Monitoring
371400
You can’t perform that action at this time.
0 commit comments