Skip to content

Commit f1116bb

Browse files
committed
wip
1 parent 849a6e8 commit f1116bb

File tree

2 files changed

+38
-32
lines changed

2 files changed

+38
-32
lines changed

README.md

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
- [Introduction](#introduction)
1212
- [Installation](#installation)
1313
- Usage
14-
- [User Configuration](#user-configuration)
15-
- [Foreign Key Type (UUID, ULID, ID)](#foreign-key-type-uuid-ulid-id)
16-
- [Visit Monitoring](#visit-monitoring)
17-
- [Delete Visit Monitoring Records By Specific Days](#delete-visit-monitoring-records-by-specific-days)
18-
- [Turn ON-OFF](#turn-on-off)
19-
- [Action Monitoring](#action-monitoring)
20-
- [Authentication Monitoring](#authentication-monitoring)
14+
- [User Configuration](#user-configuration)
15+
- [Foreign Key Type (UUID, ULID, ID)](#foreign-key-type-uuid-ulid-id)
16+
- [Visit Monitoring](#visit-monitoring)
17+
- [Delete Visit Monitoring Records By Specific Days](#delete-visit-monitoring-records-by-specific-days)
18+
- [Turn ON-OFF](#turn-on-off)
19+
- [Action Monitoring](#action-monitoring)
20+
- [Authentication Monitoring](#authentication-monitoring)
2121
- [Contributors](#contributors)
2222
- [Security](#security)
2323
- [Changelog](#changelog)
@@ -52,24 +52,24 @@ If you want to publish a config file you can use this command:
5252
php artisan vendor:publish --tag="laravel-user-monitoring-config"
5353
```
5454

55-
If you want to publish a migration files you can use this command:
55+
If you want to publish migration files you can use this command:
5656

5757
```shell
5858
php artisan vendor:publish --tag="laravel-user-monitoring-migrations"
5959
```
6060

61-
For convience, you can use this command to publish config and migration files:
61+
For convenience, you can use this command to publish config and migration files:
6262

6363
```shell
6464
php artisan vendor:publish --provider="Binafy\LaravelUserMonitoring\Providers\LaravelUserMonitoringServiceProvider"
6565
```
6666

67-
After publishing, run `php artisan migrate` command.
67+
After publishing, run the `php artisan migrate` command.
6868

6969
<a name="user-configuration"></a>
7070
## User Configuration
7171

72-
You can config your user with `user-monitoring.php` configuration file:
72+
You can config your user with the `user-monitoring.php` configuration file:
7373

7474
```php
7575
'user' => [
@@ -94,18 +94,18 @@ You can config your user with `user-monitoring.php` configuration file:
9494
'guard' => 'web',
9595

9696
/*
97-
* If you are using uuid or ulid you can change it for type of foreign_key.
97+
* If you are using uuid or ulid you can change it for the type of foreign_key.
9898
*
99-
* When you are using ulid or uuid, you need to add related trait into the models.
99+
* When you are using ulid or uuid, you need to add related traits into the models.
100100
*/
101101
'foreign_key_type' => 'id', // uuid, ulid, id
102102
],
103103
```
104104

105-
- `model`: If your user model is exists in another place, you can change it to correct namespace.
105+
- `model`: If your user model exists in another place, you can change it to the correct namespace.
106106
- `foreign_key`: You can set the user foreign_key name, like `customer_id`.
107107
- `table`: You can write your users table name if is not `users.
108-
- `guard`: The correct guard that using for user.
108+
- `guard`: The correct guard that using for the user.
109109

110110
<a name="foreign-key-type-uuid-ulid-id"></a>
111111
### Foreign Key Type (UUID, ULID, ID)
@@ -117,9 +117,9 @@ If you are using `uuid` or `ulid`, you can change `foreign_key_type` to your cor
117117
...
118118

119119
/*
120-
* If you are using uuid or ulid you can change it for type of foreign_key.
120+
* If you are using uuid or ulid you can change it for the type of foreign_key.
121121
*
122-
* When you are using ulid or uuid, you need to add related trait into the models.
122+
* When you are using ulid or uuid, you need to add related traits into the models.
123123
*/
124124
'foreign_key_type' => 'uuid', // uuid, ulid, id
125125
],
@@ -134,19 +134,25 @@ When you want to monitor all views of your application, you must follow below:
134134

135135
1. Publish the [Migrations](#publish)
136136

137-
2. Use `VisitMonitoringMiddleware` in Kernel.php, you can go to `App/Http` folder and open the `Kernel.php` file and add `VisitMonitoringMiddleware` into your middleware for example:
137+
2. Use `VisitMonitoringMiddleware` in Kernel.php, you can go to the `App/Http` folder and open the `Kernel.php` file and add `VisitMonitoringMiddleware` into your middleware for example:
138138
```php
139139
protected $middlewareGroups = [
140140
'web' => [
141141
...
142142
\Binafy\LaravelUserMonitoring\Middlewares\VisitMonitoringMiddleware::class,
143143
],
144+
145+
'api' => [
146+
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
147+
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
148+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
149+
],
144150
];
145151
```
146152

147153
After, you can see all pages monitoring :)
148154

149-
If you want to disable monitoring for specific pages you can go to `user-monitoring.php` that exists in `config` folder and add pages into `visit_monitoring` key:
155+
If you want to disable monitoring for specific pages you can go to `user-monitoring.php` that exists in the `config` folder and add pages into the `visit_monitoring` key:
150156

151157
```php
152158
'visit_monitoring' => [
@@ -163,25 +169,25 @@ If you want to disable monitoring for specific pages you can go to `user-monitor
163169
<a name="delete-visit-monitoring-records-by-specific-days"></a>
164170
### Delete Visit Monitoring Records By Specific Days
165171

166-
You may to delete records by specific days, Laravel-User-Monitoring also support this 🤩.
172+
You may delete records by specific days, Laravel-User-Monitoring also supports this 🤩.
167173

168-
First, you need go to `user-monitoring` config file and highlighting the days that you want to delete:
174+
First, you need to go to the `user-monitoring` config file and highlight the days that you want to delete:
169175

170176
```php
171177
'visit_monitoring' => [
172178
...
173179

174180
/*
175-
* If you want to delete visit rows after some days, you can change this like 360,
176-
* but you don't like to delete rows you can change it to 0.
181+
* If you want to delete visit rows after some days, you can change this to 360,
182+
* but if you don't like to delete rows you can change it to 0.
177183
*
178184
* For this feature you need Task-Scheduling => https://laravel.com/docs/10.x/scheduling
179185
*/
180186
'delete_days' => 10,
181187
],
182188
```
183189

184-
After, you need to use [Task Scheduling](https://laravel.com/docs/10.x/scheduling) to fire related command, so go to `app/Console/Kernel.php` and do like this:
190+
After, you need to use [Task Scheduling](https://laravel.com/docs/10.x/scheduling) to fire-related command, so go to `app/Console/Kernel.php` and do like this:
185191

186192
```php
187193
<?php
@@ -208,7 +214,7 @@ You can change `hourly` to `minute` or `second`, for more information you can re
208214
<a name="turn-on-off"></a>
209215
### Turn ON-OFF
210216

211-
Maybe you want to turn off visit monitoring for somedays or always, you can use configuration to turn off:
217+
Maybe you want to turn off visit monitoring for somedays or always, you can use configuration to turn it off:
212218

213219
```php
214220
'visit_monitoring' => [
@@ -226,7 +232,7 @@ Maybe you want to turn off visit monitoring for somedays or always, you can use
226232
<a name="action-monitoring"></a>
227233
## Action Monitoring
228234

229-
If you want to monitor your models actions, you can use `Actionable` trait into your model:
235+
If you want to monitor your models actions, you can use the `Actionable` trait in your model:
230236

231237
```php
232238
<?php
@@ -242,9 +248,9 @@ class Product extends Model
242248
}
243249
```
244250

245-
Now when a product readed, created, updated or deleted, you can see which users doing that.
251+
Now when a product is read, created, updated, or deleted, you can see which users doing that.
246252

247-
If you want to disable some action like created, you can use config file:
253+
If you want to disable some actions like created, you can use the config file:
248254

249255
```php
250256
'action_monitoring' => [
@@ -268,7 +274,7 @@ If you want to disable some action like created, you can use config file:
268274
## Authentication Monitoring
269275

270276
Have you ever thought about monitoring the entry and exit of users of your application? Now you can :) <br>
271-
If you want to monitor users when login or logout in your application, you need migrate the migrations and go to config file and change true for monitoring authentication.
277+
If you want to monitor users when login or logout of your application, you need to migrate the migrations and go to the config file and change true for monitoring authentication.
272278

273279
```php
274280
'authentication_monitoring' => [

config/user-monitoring.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
'guard' => 'web',
2929

3030
/*
31-
* If you are using uuid or ulid you can change it for type of foreign_key.
31+
* If you are using uuid or ulid you can change it for the type of foreign_key.
3232
*
33-
* When you are using ulid or uuid, you need to add related trait into the models.
33+
* When you are using ulid or uuid, you need to add related traits into the models.
3434
*/
3535
'foreign_key_type' => 'id', // uuid, ulid, id
3636
],
@@ -54,7 +54,7 @@
5454
],
5555

5656
/*
57-
* If you want to delete visit rows after some days, you can change this like 360,
57+
* If you want to delete visit rows after some days, you can change this to 360 for example,
5858
* but you don't like to delete rows you can change it to 0.
5959
*
6060
* For this feature you need Task-Scheduling => https://laravel.com/docs/10.x/scheduling

0 commit comments

Comments
 (0)