Skip to content

Commit e1fb34a

Browse files
authored
Update README.md
1 parent 1f6d45b commit e1fb34a

1 file changed

Lines changed: 101 additions & 25 deletions

File tree

README.md

Lines changed: 101 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# Activity Log
2-
This package is use to save all activities of user build for dashboard.
32

3+
This package is only for Laravel >=8 Framework.
44

5-
On the root of your project just run the below command and download this DIR and paste in activitylog folder. We don't have any package so you have to do it manually.
5+
<details>
6+
<summary>Manual installation process.</summary>
7+
8+
On the root of your project just run the below command download this DIR and paste it into the activitylog folder. We don't have any package so you have to do it manually.
69

710
````
811
mkdir -p packages/lcw/activitylog
912
````
13+
After copying, the code goes to that directory and updates the composer for that use below command.
14+
15+
16+
````
17+
cd packages/lcw/activitylog/
18+
composer dump-autoload
19+
````
20+
Simple use Just add the below line in your root composer.json in the autoload section.
1021

11-
Simple use just adds the below line in your root `composer.json` in autoload section.
1222

1323
````
1424
"Lcw\\Activitylog\\": "packages/lcw/activitylog/src/"
1525
````
26+
The composer.json must look like the below after adding the like.
1627

17-
The `composer.json` must look like the below after adding the like.
1828

1929
````
2030
"autoload": {
@@ -26,15 +36,43 @@ The `composer.json` must look like the below after adding the like.
2636
}
2737
},
2838
````
29-
3039
After adding run the below command to load the package in your composer.
3140

41+
42+
43+
````composer dump-autoload````
44+
45+
</details>
46+
47+
48+
49+
50+
Composer
51+
Installation with the composer is very simple, this package is only for NFS KOT so we need to fetch the package from a private repository. For that, you just need to add the below lines in your root composer.json file.
52+
53+
Open `composer.json` and add the below line under the repositories array. If you have any other package then append this package. The must look like below.
54+
55+
3256
````
33-
composer dump-autoload
57+
"repositories": [
58+
....,
59+
....,
60+
....,
61+
{
62+
"type": "vcs",
63+
"url": "https://github.com/kateoftokyo/Dashboard-Activity-Log"
64+
}
65+
],
3466
````
67+
After adding the above code try to install the package in your project.
68+
3569

36-
After the composer add the service provider in your `config/app.php`. Open file `config/app.php` and add the below line under the provider's array, better to add it in the packages section.
70+
````
71+
composer require lcw/activitylog
72+
````
3773

74+
## Add Service
75+
After the composer add the service provider in your `config/app.php`. Open file config/app.php and add the below line under the provider's array, better to add it in the packages section.
3876
````
3977
/*
4078
* Package Service Providers...
@@ -44,53 +82,91 @@ After the composer add the service provider in your `config/app.php`. Open file
4482
Lcw\Activitylog\Providers\ActivityLogProvider::class,
4583
````
4684

85+
## Migration Export
4786
For migration, export runs the below command.
87+
````
88+
php artisan vendor:publish --provider="Lcw\Activitylog\Providers\ActivityLogProvider" --tag="migrations"
89+
````
90+
After migration publishes just run a simple command to add a table.
4891

4992
````
50-
php artisan vendor:publish --provider="Learncodeweb\Activitylog\Providers\ActivityLogProvider" --tag="migrations"
93+
php artisan migrate
5194
````
5295

53-
After migration `publishes` just run a simple command to add a table.
96+
## Config Export
97+
You can also export the config file into your project root config, this function empowers you to change things if you want. With the config export, you can set the delete limit in your config file and also you can add route PATH/NAMES where you don't want to save activity.
5498

99+
To export the config on your root run the below command.
55100
````
56-
php artisan migrate
101+
php artisan vendor:publish --provider="Lcw\Activitylog\Providers\ActivityLogProvider" --tag="config"
102+
````
103+
After `publish config` you can set the parameters as per your need. Below is the list of all available parameters.
104+
105+
````
106+
/**
107+
* Change the value to change the activity log delete limit
108+
* By default it is 3 in months
109+
* @param integer in months
110+
*/
111+
'delete_limit' => 2,
112+
/**
113+
* Pass route path or names
114+
* If you don't want to create the activity log use ignore_routes
115+
* @param route URI/NAMES
116+
*/
117+
'ignore_routes' => ['dashboard.index', 'settings.download.history.activity_log'],
57118
````
119+
Set config in settings ignore_route [If set system ignore to create the activity on that route]
58120

59-
There is a default view to see the logs but you can made your own log view in your app. With this package one route will be created which is mentioned below.
121+
You can also delete the data and change the default limit by editing the config file config\lcw_activity_log_config.php. Pass the value in months default is set at 3 Months.
60122

123+
# Define in months only
124+
````
125+
delete_limit = 2
61126
````
127+
Default View
128+
There is a default view to see the logs but you can make your own log view in your app. With this package, one route will be created which is mentioned below.
129+
130+
131+
62132
# Route Name
133+
````
63134
lcw_activity_log_index
64-
135+
````
65136
# URI
137+
````
66138
Your-Domain-Url/log
67139
````
68-
69140
You can create your own view and get the log data by using the below method in your controller.
70141

71142
````
72143
use Lcw\Activitylog\ActivityLog;
73-
74144
$activityLog = new ActivityLog();
75145
$log = $activityLog->get($request);
76146
````
77-
78-
You can also delete the data and change the default limit by defining the variable in your environment.
79-
Pass the value in months default is set at `3 Months`. Open the `.env` file and define the below variable to change the default auto-delete process.
80-
147+
You also can delete the log by calling the logDelete() method like below in your controller.
81148
````
82-
# Define in months only
83-
84-
ACTIVITY_LOG_DEL=1
149+
use Lcw\Activitylog\ActivityLog;
150+
$activityLog = new ActivityLog();
151+
$log = $activityLog->logDelete(1); # delete all one month old log data
85152
````
86153

87-
And you also can delete the log by calling the `logDelete` method like below in your controller.
154+
## Custom Creation
155+
You can create a custom activity log with the below method. The parameters you need to pass in the custom log are given below.
156+
````
157+
@param log [string]
158+
@param server_ip [The server IP address]
159+
@param user_ip [The client/user IP address]
160+
@param route_detail [Array with route path details]
161+
@param query_string [Array with parameters]
162+
@param user_id [Auth session id]
163+
@param user [Array of auth]
164+
@param created_at [datetime]
165+
````
88166

89167
````
90168
use Lcw\Activitylog\ActivityLog;
91-
92169
$activityLog = new ActivityLog();
93-
$log = $activityLog->logDelete(1); # delete all one month old log data
170+
$activityLog->create(['log' => 'Update notification', 'query_string' => $parameters]);
94171
````
95-
96172
If you need any help ask me, Thank you.

0 commit comments

Comments
 (0)