You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-53Lines changed: 65 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ After publishing, run the `php artisan migrate` command.
97
97
<aname="usage"></a>
98
98
## Usage
99
99
100
-
The `Laravel-User-Monitoring`, need to use middleware, traits, etc ... and it's not hard, enjoys :)
100
+
The `Laravel-User-Monitoring`, needs to use middleware, traits, etc ... and it's not hard, enjoys :)
101
101
102
102
<aname="configuration"></a>
103
103
## Configuration
@@ -117,10 +117,13 @@ Also, if you want to change the route file name, you can go to the config file a
117
117
118
118
```php
119
119
/*
120
-
* Configurations.
120
+
* Main configuration settings for the package.
121
121
*/
122
122
'config' => [
123
123
'routes' => [
124
+
/*
125
+
* Path to the route file that handles user monitoring routes.
126
+
*/
124
127
'file_path' => 'routes/user-monitoring.php',
125
128
],
126
129
],
@@ -134,39 +137,36 @@ You can config your user with the `user-monitoring.php` configuration file:
134
137
```php
135
138
'user' => [
136
139
/*
137
-
* User model.
140
+
* Specify the fully qualified class name of the user model.
138
141
*/
139
142
'model' => 'App\Models\User',
140
143
141
144
/*
142
-
* Foreign Key column name.
145
+
* Name of the foreign key column linking user data to other models.
143
146
*/
144
147
'foreign_key' => 'user_id',
145
148
146
149
/*
147
-
* Users table name.
150
+
* Name of the table storing user data.
148
151
*/
149
152
'table' => 'users',
150
153
151
154
/*
152
-
* You can customize which guards are used to authenticate or
153
-
* store user data across different parts of the application. Each guard
154
-
* will be checked independently, allowing users to be authenticated by
155
-
* multiple guards and enabling more flexible user management.
156
-
*
157
-
* Make sure that each guard is properly configured under the 'guards' section in the auth.php config file.
155
+
* Defines the authentication guards used for verifying the user.
156
+
* Multiple guards can be specified for flexible authentication strategies.
157
+
* Ensure these guards are configured correctly in the 'guards' section of the auth.php config file.
158
158
*/
159
159
'guards' => ['web'],
160
160
161
161
/*
162
-
* If you are using uuid or ulid you can change it for the type of foreign_key.
163
-
*
164
-
* When using ulid or uuid, you need to add related traits into the models.
162
+
* Specify the type of foreign key being used (e.g., 'id', 'uuid', 'ulid').
163
+
* For non-standard IDs, make sure to add the relevant traits to your models.
165
164
*/
166
-
'foreign_key_type' => 'id', // uuid, ulid, id
165
+
'foreign_key_type' => 'id', // Options: uuid, ulid, id
167
166
168
167
/*
169
-
* If you want to display a custom username, you can create your attribute in User and change this value.
168
+
* Attribute of the user model used to display the user's name.
169
+
* If you wish to use a different attribute (e.g., username), change this value accordingly.
170
170
*/
171
171
'display_attribute' => 'name',
172
172
],
@@ -177,7 +177,7 @@ You can config your user with the `user-monitoring.php` configuration file:
177
177
-`table`: You can write your users table name if is not `users.
178
178
-`guards`: The guards are used to authenticate.
179
179
-`foreign_key_type`: The foreign key type (uuid-ulid-id).
180
-
-`display_attribute`: The special attribute of user that you want to show in views.
180
+
-`display_attribute`: The special attribute of the user that you want to show in views.
181
181
182
182
<aname="foreign-key-type-uuid-ulid-id"></a>
183
183
### Foreign Key Type (UUID, ULID, ID)
@@ -189,11 +189,10 @@ If you are using `uuid` or `ulid`, you can change `foreign_key_type` to your cor
189
189
...
190
190
191
191
/*
192
-
* If you are using uuid or ulid you can change it for the type of foreign_key.
193
-
*
194
-
* When you are using ulid or uuid, you need to add related traits into the models.
192
+
* Specify the type of foreign key being used (e.g., 'id', 'uuid', 'ulid').
193
+
* For non-standard IDs, make sure to add the relevant traits to your models.
195
194
*/
196
-
'foreign_key_type' => 'uuid', // uuid, ulid, id
195
+
'foreign_key_type' => 'id', // Options: uuid, ulid, id
197
196
],
198
197
```
199
198
@@ -229,11 +228,13 @@ If you want to disable monitoring for specific pages you can go to `user-monitor
229
228
```php
230
229
'visit_monitoring' => [
231
230
/*
232
-
* You can specify pages not to be monitored.
231
+
* List of pages that should be excluded from visit monitoring.
232
+
* Add route names or URL paths to this array if you want to exclude certain pages.
233
233
*/
234
234
'except_pages' => [
235
-
'home',
236
-
'admin/dashboard',
235
+
'user-monitoring/visits-monitoring',
236
+
'user-monitoring/actions-monitoring',
237
+
'user-monitoring/authentications-monitoring',
237
238
],
238
239
],
239
240
```
@@ -250,12 +251,13 @@ First, you need to go to the `user-monitoring` config file and highlight the day
250
251
...
251
252
252
253
/*
253
-
* If you want to delete visit rows after some days, you can change this to 360,
254
-
* but if you don't like to delete rows you can change it to 0.
254
+
* Set the number of days after which visit records should be automatically deleted.
255
+
* Set to 0 to disable automatic deletion.
255
256
*
256
-
* For this feature you need Task-Scheduling => https://laravel.com/docs/10.x/scheduling
257
+
* To enable automatic deletion, configure Laravel's task scheduling as outlined here:
258
+
* https://laravel.com/docs/scheduling
257
259
*/
258
-
'delete_days' => 10,
260
+
'delete_days' => 0,
259
261
],
260
262
```
261
263
@@ -286,14 +288,15 @@ You can change `hourly` to `minute` or `second`, for more information you can re
286
288
<aname="turn-on-off"></a>
287
289
### Turn ON-OFF
288
290
289
-
Maybe you want to turn off visit monitoring for somedays or always, you can use configuration to turn it off:
291
+
Maybe you want to turn off visit monitoring for some or always, you can use configuration to turn it off:
290
292
291
293
```php
292
294
'visit_monitoring' => [
293
295
...
294
296
295
297
/*
296
-
* If you want to disable visit monitoring, you can change it to false.
298
+
* Enable or disable the visit monitoring feature.
299
+
* Set false to disable tracking of user visits.
297
300
*/
298
301
'turn_on' => true,
299
302
@@ -304,7 +307,7 @@ Maybe you want to turn off visit monitoring for somedays or always, you can use
304
307
<aname="visit-monitoring-views"></a>
305
308
### Visit Monitoring Views
306
309
307
-
Laravel-User-Monitoring also has an amazing views that you can use it very easy, just need to go to `/user-monitoring/visits-monitoring`url, and enjoy:
310
+
The `Laravel-User-Monitoring` also has amazing views that you can use very easily, just need to go to the `/user-monitoring/visits-monitoring`URL, and enjoy:
@@ -314,16 +317,17 @@ Laravel-User-Monitoring also has an amazing views that you can use it very easy,
314
317
Maybe you may disable record visits for `Ajax` requests, you can use config to disable it:
315
318
316
319
```php
317
-
'visit_monitoring' => [
318
-
...
320
+
'visit_monitoring' => [
321
+
...
319
322
320
-
/*
321
-
* If you want to disable visit monitoring in Ajax mode, set it to false.
322
-
*/
323
-
'ajax_requests' => true,
323
+
/*
324
+
* Enable or disable monitoring for AJAX requests.
325
+
* Set to false if you do not wish to track AJAX-based page loads.
326
+
*/
327
+
'ajax_requests' => true,
324
328
325
-
...
326
-
],
329
+
...
330
+
],
327
331
```
328
332
329
333
When set to false, Ajax requests will not be recorded.
@@ -356,11 +360,10 @@ If you want to disable some actions like created, you can use the config file:
356
360
...
357
361
358
362
/*
359
-
* Monitor actions.
360
-
*
361
-
* You can set true/false for monitor actions like (store, update, and ...).
363
+
* Enable or disable monitoring of specific actions (e.g., store, update, delete).
364
+
* Set to true to monitor actions or false to disable.
362
365
*/
363
-
'on_store' => false,
366
+
'on_store' => true,
364
367
'on_update' => true,
365
368
'on_destroy' => true,
366
369
'on_read' => true,
@@ -387,7 +390,8 @@ If you want to monitor users when logging in or logout of your application, you
387
390
...
388
391
389
392
/*
390
-
* You can set true/false for monitor login or logout.
393
+
* Enable or disable monitoring of user login and logout events.
394
+
* Set to true to track these actions, or false to disable.
391
395
*/
392
396
'on_login' => true,
393
397
'on_logout' => true,
@@ -400,13 +404,21 @@ If you want to monitor users when logging in or logout of your application, you
400
404
If you are using Reverse Proxy (Nginx or Cloudflare), you can use config to get real IP from a specific header like `X-Real-IP` or `X-Forwarded-For`:
401
405
402
406
```php
403
-
/**
404
-
* Determines if the application should use reverse proxy headers to fetch the real client IP
405
-
* If set to true, it will try to get the IP from the specified header (X-Real-IP or X-Forwarded-For)
406
-
* This is useful when using reverse proxies like Nginx or Cloudflare.
407
-
*/
408
-
'use_reverse_proxy_ip' => true,
409
-
'real_ip_header' => 'X-Forwarded-For',
407
+
'action_monitoring' => [
408
+
...
409
+
410
+
/*
411
+
* If your application is behind a reverse proxy (e.g., Nginx or Cloudflare),
412
+
* enable this setting to fetch the real client IP from the proxy headers.
413
+
*/
414
+
'use_reverse_proxy_ip' => false,
415
+
416
+
/*
417
+
* The header used by reverse proxies to forward the real client IP.
418
+
* Common values are 'X-Forwarded-For' or 'X-Real-IP'.
419
+
*/
420
+
'real_ip_header' => 'X-Forwarded-For',
421
+
],
410
422
```
411
423
412
424
<aname="authentication-monitoring-views"></a>
@@ -441,7 +453,7 @@ If you discover any security-related issues, please email `[email protected]` i
441
453
<aname="chanelog"></a>
442
454
## Changelog
443
455
444
-
The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.
456
+
The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each Laravel User Monitoring package version.
445
457
446
458
<aname="license"></a>
447
459
## License
@@ -456,7 +468,7 @@ The MIT License (MIT). Please see [License File](https://github.com/binafy/larav
456
468
<aname="conclusion"></a>
457
469
## Conclusion
458
470
459
-
Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need further assistance, please refer to the documentation or seek help from the package's GitHub repository. Happy monitoring!
471
+
Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need any more help, please refer to the documentation or ask for help from the package's GitHub repository. Happy monitoring!
0 commit comments