10
10
- [ Features] ( #features )
11
11
- [ Requirements] ( #requirements )
12
12
- [ Installation Instructions] ( #installation-instructions )
13
+ - [ Configuration] ( #configuration )
14
+ - [ Environment File] ( #environment-file )
15
+ - [ Usage] ( #usage )
16
+ - [ Authentication Middleware Usage] ( #authentication-middleware-usage )
17
+ - [ Trait Usage] ( #trait-usage )
18
+ - [ Routes] ( #routes )
19
+ - [ Screenshots] ( #screenshots )
20
+ - [ File Tree] ( #file-tree )
21
+ - [ License] ( #license )
22
+
13
23
14
24
### About
15
25
Laravel logger is an activity event logger for your laravel application. It comes out the box with ready to use with dashboard to view your activity. Laravel logger can be added as a middleware or called through a trait. This package is easily configurable and customizable.
16
26
27
+ Laravel logger can work out the box with or without the following roles packages:
28
+ * [ jeremykenedy/laravel-roles] ( https://github.com/jeremykenedy/laravel-roles )
29
+ * [ spatie/laravel-permission] ( https://github.com/spatie/laravel-permission )
30
+ * [ Zizaco/entrust] ( https://github.com/Zizaco/entrust )
31
+ * [ romanbican/roles] ( https://github.com/romanbican/roles )
32
+ * [ ultraware/roles] ( https://github.com/ultraware/roles )
33
+
17
34
### Features
18
35
19
36
| Laravel Logger Features |
20
37
| :------------ |
21
38
||
22
39
23
- ## Requirements
40
+ ### Requirements
24
41
* [ Laravel 5.1, 5.2, 5.3, 5.4, or 5.5+] ( https://laravel.com/docs/installation )
25
-
42
+ * [ jaybizzle/laravel-crawler-detect ] ( https://github.com/JayBizzle/Laravel-Crawler-Detect ) included dependency in composer.json
26
43
27
44
### Installation Instructions
28
-
29
45
1 . From your projects root folder in terminal run:
30
46
31
47
``` bash
@@ -46,34 +62,163 @@ Register the package with laravel in `config/app.php` under `providers` with the
46
62
];
47
63
```
48
64
49
- 3 . Publish the packages views, config file, assets, and language files by running the following from your projects root folder:
65
+ 3 . Optionally publish the packages views, config file, assets, and language files by running the following from your projects root folder:
50
66
51
67
``` bash
52
68
php artisan vendor:publish --tag=laravellogger
53
69
```
54
70
71
+ ### Configuration
72
+ Laravel Logger can be configured in directly in ` /config/laravel-logger.php ` if you published the assets.
73
+ Or you can variables to your ` .env ` file.
55
74
56
75
76
+ ##### Environment File
77
+ Here are the ` .env ` file variables available:
57
78
79
+ ```
80
+ LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
81
+ LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
82
+ LARAVEL_LOGGER_ROLES_ENABLED=true
83
+ LARAVEL_LOGGER_ROLES_MIDDLWARE=role:admin
84
+ LARAVEL_LOGGER_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
85
+ LARAVEL_LOGGER_MIDDLEWARE_ENABLED=true
86
+ LARAVEL_LOGGER_USER_MODEL=App\Models\User
87
+ LARAVEL_LOGGER_PAGINATION_ENABLED=true
88
+ LARAVEL_LOGGER_PAGINATION_PER_PAGE=25
89
+ LARAVEL_LOGGER_DATATABLES_ENABLED=true
90
+ LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED=true
91
+ LARAVEL_LOGGER_DASHBOARD_DRILLABLE=true
92
+ LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE=true
93
+ LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED=true
94
+ LARAVEL_LOGGER_JQUERY_CDN_ENABLED=true
95
+ LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
96
+ LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
97
+ LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
98
+ LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
99
+ LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
100
+ LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
101
+ LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
102
+ LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
103
+ LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
104
+ ```
58
105
106
+ ### Usage
59
107
108
+ ##### Middleware Usage
109
+ Events for laravel authentication scaffolding are listened for as providers and are enabled via middleware.
110
+ You can add events to your routes and controllers via the ` activity ` middleware.
60
111
112
+ Example to start recording page views using middlware in ` web.php ` :
61
113
114
+ ```
115
+ Route::group(['middleware' => ['web', 'activity']], function () {
116
+ Route::get('/', 'WelcomeController@welcome')->name('welcome');
117
+ });
118
+ ```
62
119
120
+ This middlware can be enabled/disabled in the configuration settings.
63
121
122
+ ##### Trait Usage
123
+ Events can be recorded directly by using the trait.
124
+ When using the trait you can customize the event description.
64
125
126
+ To use the trait:
127
+ 1 . Include the call in the head of your class file:
128
+ ```
129
+ use jeremykenedy\LaravelLogger\App\Http\Traits\ActivityLogger;
130
+ ```
65
131
132
+ 2 . Include the trait call in the opening of your class:
133
+ ```
134
+ use ActivityLogger;
135
+ ```
66
136
137
+ 3 . You can record the activity my calling the traits method:
138
+ ```
139
+ ActivityLogger::activity("Logging this activity.");
140
+ ```
67
141
142
+ ### Routes
143
+ ##### Laravel Activity Dashbaord Routes
68
144
145
+ * ``` /activity ```
146
+ * ``` /activity/cleared ```
147
+ * ``` /activity/log/{id} ```
148
+ * ``` /activity/cleared/log/{id} ```
69
149
150
+ ### Screenshots
151
+ ![ ALT] ( URL )
70
152
153
+ ### File Tree
154
+ ```
155
+ ├── .gitignore
156
+ ├── CODE_OF_CONDUCT.md
157
+ ├── LICENSE
158
+ ├── README.md
159
+ ├── composer.json
160
+ └── src
161
+ ├── .env.example
162
+ ├── LaravelLoggerServiceProvider.php
163
+ ├── app
164
+ │ ├── Http
165
+ │ │ ├── Controllers
166
+ │ │ │ └── LaravelLoggerController.php
167
+ │ │ ├── Middleware
168
+ │ │ │ └── LogActivity.php
169
+ │ │ └── Traits
170
+ │ │ ├── ActivityLogger.php
171
+ │ │ ├── IpAddressDetails.php
172
+ │ │ └── UserAgentDetails.php
173
+ │ ├── Listeners
174
+ │ │ ├── LogAuthenticated.php
175
+ │ │ ├── LogAuthenticationAttempt.php
176
+ │ │ ├── LogFailedLogin.php
177
+ │ │ ├── LogLockout.php
178
+ │ │ ├── LogPasswordReset.php
179
+ │ │ ├── LogSuccessfulLogin.php
180
+ │ │ └── LogSuccessfulLogout.php
181
+ │ ├── Logic
182
+ │ │ └── helpers.php
183
+ │ └── Models
184
+ │ └── Activity.php
185
+ ├── config
186
+ │ └── laravel-logger.php
187
+ ├── database
188
+ │ └── migrations
189
+ │ └── 2017_11_04_103444_create_laravel_logger_activity_table.php
190
+ ├── resources
191
+ │ ├── lang
192
+ │ │ └── en
193
+ │ │ └── laravel-logger.php
194
+ │ └── views
195
+ │ ├── forms
196
+ │ │ ├── clear-activity-log.blade.php
197
+ │ │ ├── delete-activity-log.blade.php
198
+ │ │ └── restore-activity-log.blade.php
199
+ │ ├── logger
200
+ │ │ ├── activity-log-cleared.blade.php
201
+ │ │ ├── activity-log-item.blade.php
202
+ │ │ ├── activity-log.blade.php
203
+ │ │ └── partials
204
+ │ │ └── activity-table.blade.php
205
+ │ ├── modals
206
+ │ │ └── confirm-modal.blade.php
207
+ │ ├── partials
208
+ │ │ ├── form-status.blade.php
209
+ │ │ └── styles.blade.php
210
+ │ └── scripts
211
+ │ ├── clickable-row.blade.php
212
+ │ ├── confirm-modal.blade.php
213
+ │ ├── datatables.blade.php
214
+ │ └── tooltip.blade.php
215
+ └── routes
216
+ └── web.php
217
+ ```
71
218
219
+ * Tree command can be installed using brew: ` brew install tree `
220
+ * File tree generated using command ` tree -a -I '.git|node_modules|vendor|storage|tests `
72
221
73
- Laravel logger can work out the box with or without the following roles packages:
74
- * [ jeremykenedy/laravel-roles] ( https://github.com/jeremykenedy/laravel-roles )
75
- * [ spatie/laravel-permission] ( https://github.com/spatie/laravel-permission )
76
- * [ Zizaco/entrust] ( https://github.com/Zizaco/entrust )
77
- * [ romanbican/roles] ( https://github.com/romanbican/roles )
78
- * [ ultraware/roles] ( https://github.com/ultraware/roles )
222
+ ### License
223
+ Laravel-logger is licensed under the MIT license. Enjoy!
79
224
0 commit comments