├── .env.travis
├── .github
└── FUNDING.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── composer.json
└── src
├── .env.example
├── App
├── Http
│ ├── Controllers
│ │ └── LaravelLoggerController.php
│ ├── Middleware
│ │ └── LogActivity.php
│ └── Traits
│ │ ├── ActivityLogger.php
│ │ ├── IpAddressDetails.php
│ │ └── UserAgentDetails.php
├── Listeners
│ ├── LogAuthenticated.php
│ ├── LogAuthenticationAttempt.php
│ ├── LogFailedLogin.php
│ ├── LogLockout.php
│ ├── LogPasswordReset.php
│ ├── LogSuccessfulLogin.php
│ └── LogSuccessfulLogout.php
├── Logic
│ └── helpers.php
└── Models
│ └── Activity.php
├── LaravelLoggerServiceProvider.php
├── config
└── laravel-logger.php
├── database
└── migrations
│ └── 2017_11_04_103444_create_laravel_logger_activity_table.php
├── resources
├── lang
│ ├── de
│ │ └── laravel-logger.php
│ ├── en
│ │ └── laravel-logger.php
│ ├── fr
│ │ └── laravel-logger.php
│ ├── pt-br
│ │ └── laravel-logger.php
│ └── tr
│ │ └── laravel-logger.php
└── views
│ ├── forms
│ ├── clear-activity-log.blade.php
│ ├── delete-activity-log.blade.php
│ └── restore-activity-log.blade.php
│ ├── logger
│ ├── activity-log-cleared.blade.php
│ ├── activity-log-item.blade.php
│ ├── activity-log.blade.php
│ └── partials
│ │ └── activity-table.blade.php
│ ├── modals
│ └── confirm-modal.blade.php
│ ├── partials
│ ├── form-live-search.blade.php
│ ├── form-search.blade.php
│ ├── form-status.blade.php
│ ├── scripts.blade.php
│ └── styles.blade.php
│ └── scripts
│ ├── add-title-attribute.blade.php
│ ├── clickable-row.blade.php
│ ├── confirm-modal.blade.php
│ ├── datatables.blade.php
│ ├── live-search-script.php
│ └── tooltip.blade.php
└── routes
└── web.php
/.env.travis:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://localhost
7 |
8 | DB_CONNECTION=mysql
9 | DB_HOST=127.0.0.1
10 | DB_PORT=3306
11 | DB_DATABASE=laravellogger
12 | DB_USERNAME=root
13 | DB_PASSWORD=
14 |
15 | BROADCAST_DRIVER=log
16 | CACHE_DRIVER=array
17 | SESSION_DRIVER=file
18 | SESSION_LIFETIME=120
19 | QUEUE_DRIVER=sync
20 |
21 | REDIS_HOST=127.0.0.1
22 | REDIS_PASSWORD=null
23 | REDIS_PORT=6379
24 |
25 | MAIL_DRIVER=smtp
26 | MAIL_HOST=smtp.mailtrap.io
27 | MAIL_PORT=2525
28 | MAIL_USERNAME=null
29 | MAIL_PASSWORD=null
30 | MAIL_ENCRYPTION=null
31 |
32 | PUSHER_APP_ID=
33 | PUSHER_APP_KEY=
34 | PUSHER_APP_SECRET=
35 | PUSHER_APP_CLUSTER=mt1
36 |
37 | LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
38 | LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
39 | LARAVEL_LOGGER_ROLES_ENABLED=false
40 | LARAVEL_LOGGER_ROLES_MIDDLWARE=role:admin
41 | LARAVEL_LOGGER_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
42 | LARAVEL_LOGGER_MIDDLEWARE_ENABLED=true
43 | LARAVEL_LOGGER_MIDDLEWARE_EXCEPT=ignore1pattern1,ignorepattern2
44 | LARAVEL_LOGGER_USER_MODEL=App\Models\User
45 | LARAVEL_LOGGER_PAGINATION_ENABLED=true
46 | LARAVEL_LOGGER_PAGINATION_PER_PAGE=25
47 | LARAVEL_LOGGER_DATATABLES_ENABLED=true
48 | LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED=true
49 | LARAVEL_LOGGER_DASHBOARD_DRILLABLE=true
50 | LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE=true
51 | LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED=true
52 | LARAVEL_LOGGER_JQUERY_CDN_ENABLED=true
53 | LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
54 | LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
55 | LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
56 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
57 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
58 | LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
59 | LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
60 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
61 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
62 | LARAVEL_LOGGER_POPPER_JS_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js
63 | LARAVEL_LOGGER_BLADE_PLACEMENT=yield
64 | LARAVEL_LOGGER_BLADE_PLACEMENT_CSS=template_linked_css
65 | LARAVEL_LOGGER_BLADE_PLACEMENT_JS=footer_scripts
66 |
67 | LARAVEL_LOGGER_ENABLE_SEARCH=true
68 | LARAVEL_LOGGER_SEARCH_FIELDS=description,user,method,route,ip
69 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [jeremykenedy]
4 | patreon: jeremykenedy
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### OSX BOOGERS ###
2 | .DS_Store
3 | *._DS_Store
4 | ._.DS_Store
5 | *._
6 | ._*
7 | ._.*
8 |
9 | ### WINDOWS BOOGERS ###
10 | Thumbs.db
11 |
12 | ### Sass ###
13 | /.sass-cache/*
14 | .sass-cache
15 |
16 | ### SUBLIMETEXT BOOGERS ###
17 | *.sublime-workspace
18 |
19 | ### PHPSTORM BOOGERS ###
20 | .idea/*
21 | /.idea/*
22 |
23 | ### DIFFERENT TYPE OF MASTER CONFIGS ###
24 | composer.lock
25 | composer.phar
26 |
27 | ### ASSET EXCLUSIONS ###
28 | vendor/
29 | /vendor
30 | /log
31 | .php_cs.cache
32 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | sudo: required
3 | dist: trusty
4 | group: edge
5 |
6 | php:
7 | - 7.3
8 | - 7.4
9 |
10 | sudo: false
11 |
12 | services:
13 | - mysql
14 |
15 | before_script:
16 | - mysql -u root -e 'create database laravellogger;'
17 | - curl -s http://getcomposer.org/installer | php
18 | - php composer.phar install
19 | - composer create-project --prefer-dist laravel/laravel laravellogger
20 | - cp .env.travis laravellogger/.env
21 | - cd laravellogger
22 | - composer self-update
23 | - composer install --prefer-source --no-interaction
24 | - composer require jeremykenedy/laravel-logger
25 | - php artisan key:generate
26 | - php artisan vendor:publish --tag=LaravelLogger
27 | - composer dump-autoload
28 | - php artisan clear-compiled
29 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jeremykenedy@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 jeremykenedy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Laravel Activity Logger
4 | Laravel logger is an activity event logger for your Laravel or Lumen 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. Easily have an Activity Log. This package is easily configurable and customizable. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, 7, 8 and 9+
5 |
6 | [](https://packagist.org/packages/jeremykenedy/laravel-logger)
7 | [](https://packagist.org/packages/jeremykenedy/laravel-logger)
8 |
9 |
10 |
11 | [](https://scrutinizer-ci.com/g/jeremykenedy/laravel-logger/?branch=master)
12 | [](https://opensource.org/licenses/MIT)
13 |
14 | #### Table of contents
15 | - [Features](#features)
16 | - [Requirements](#requirements)
17 | - [Integrations](#integrations)
18 | - [Laravel Installation Instructions](#laravel-installation-instructions)
19 | - [Lumen Installation Instructions](#lumen-installation-instructions)
20 | - [Configuration](#configuration)
21 | - [Environment File](#environment-file)
22 | - [Usage](#usage)
23 | - [Authentication Middleware Usage](#authentication-middleware-usage)
24 | - [Trait Usage](#trait-usage)
25 | - [Routes](#routes)
26 | - [Search](#search)
27 | - [Screenshots](#screenshots)
28 | - [File Tree](#file-tree)
29 | - [Opening an Issue](#opening-an-issue)
30 | - [License](#license)
31 |
32 | ### Features
33 | | Laravel Activity Logger Features |
34 | | :------------ |
35 | |Logs login page visits|
36 | |Logs user logins|
37 | |Logs user logouts|
38 | |Routing Events can recording using middleware|
39 | |Records activity timestamps|
40 | |Records activity description|
41 | |Records activity details (optional)|
42 | |Records model related to the activity (optional)|
43 | |Records activity user type with crawler detection|
44 | |Records activity Method|
45 | |Records activity Route|
46 | |Records activity Ip Address|
47 | |Records activity User Agent|
48 | |Records activity Browser Language|
49 | |Records activity referrer|
50 | |Customizable activity model|
51 | |Activity panel dashboard|
52 | |Individual activity drilldown report dashboard|
53 | |Activity Drilldown looks up Id Address meta information|
54 | |Activity Drilldown shows user roles if enabled|
55 | |Activity Drilldown shows associated user events|
56 | |Activity log can be cleared, restored, and destroyed using eloquent softdeletes|
57 | |Cleared activity logs can be viewed and have drilldown ability|
58 | |Uses font awesome, cdn assets can be optionally called in configuration|
59 | |Uses [Geoplugin API](http://www.geoplugin.com/) for drilldown IP meta information|
60 | |Uses Language localization files|
61 | |Lots of [configuration](#configuration) options|
62 |
63 | ### Requirements
64 | * [Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, and 7+](https://laravel.com/docs/installation)
65 | * [jaybizzle/laravel-crawler-detect](https://github.com/JayBizzle/Laravel-Crawler-Detect) included dependency in composer.json (for crawler detection)
66 |
67 | ### :film_strip: Video Tour
68 | If you'd prefer a more visual review of this package, please watch this video on Laravel Package Tutorial.
69 |
70 | [
](https://youtu.be/mHLSv9XhTuk)
71 |
72 | ### Integrations
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)
79 |
80 | ### Laravel Installation Instructions
81 | 1. From your projects root folder in terminal run:
82 |
83 | ```bash
84 | composer require jeremykenedy/laravel-logger
85 | ```
86 |
87 | 2. Register the package
88 |
89 | * Laravel 5.5 and up
90 | Uses package auto discovery feature, no need to edit the `config/app.php` file.
91 |
92 | * Laravel 5.4 and below
93 | Register the package with laravel in `config/app.php` under `providers` with the following:
94 |
95 | ```php
96 | 'providers' => [
97 | jeremykenedy\LaravelLogger\LaravelLoggerServiceProvider::class,
98 | ];
99 | ```
100 |
101 | 3. Run the migration to add the table to record the activities to:
102 |
103 | ```php
104 | php artisan migrate
105 | ```
106 |
107 | * Note: If you want to specify a different table or connection make sure you update your `.env` file with the needed configuration variables.
108 |
109 | 4. Optionally Update your `.env` file and associated settings (see [Environment File](#environment-file) section)
110 |
111 | 5. Optionally publish the packages views, config file, assets, and language files by running the following from your projects root folder:
112 |
113 | ```bash
114 | php artisan vendor:publish --tag=LaravelLogger
115 | ```
116 |
117 | ### Lumen Installation Instructions
118 | ##### This installs laravel-logger without the GUI
119 |
120 | 1. From your projects root folder in terminal run:
121 |
122 | ```bash
123 | composer require jeremykenedy/laravel-logger
124 | ```
125 |
126 | 2. Register the package
127 |
128 | Register the package with laravel in `bootstrap/app.php` with the following:
129 |
130 | ```php
131 | $app->register(\Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider::class);
132 | $app->configure('laravel-logger');
133 | $app->register(\jeremykenedy\LaravelLogger\LaravelLoggerServiceProvider::class);
134 | $app->routeMiddleware(['activity' => \jeremykenedy\LaravelLogger\App\Http\Middleware\LogActivity::class, ]);
135 | ```
136 |
137 | 3. Copy the configuration file [laravel-logger.php](src/config/laravel-logger.php) to your `config/` directory
138 |
139 | ##### Set LARAVEL_LOGGER_DISABLE_ROUTES=true in your .env file!
140 |
141 |
142 | 4. Run the migration to add the table to record the activities to:
143 |
144 | ```php
145 | php artisan migrate
146 | ```
147 |
148 | * Note: If you want to specify a different table or connection make sure you update your `.env` file with the needed configuration variables.
149 |
150 | 5. Optionally Update your `.env` file and associated settings (see [Environment File](#environment-file) section)
151 |
152 |
153 |
154 |
155 | ### Configuration
156 | Laravel Activity Logger can be configured in directly in `/config/laravel-logger.php` if you published the assets.
157 | Or you can variables to your `.env` file.
158 |
159 |
160 | ##### Environment File
161 | Here are the `.env` file variables available:
162 |
163 | ```dotenv
164 | LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
165 | LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
166 | LARAVEL_LOGGER_ROLES_ENABLED=true
167 | LARAVEL_LOGGER_ROLES_MIDDLWARE=role:admin
168 | LARAVEL_LOGGER_MIDDLEWARE_ENABLED=true
169 | LARAVEL_LOGGER_MIDDLEWARE_EXCEPT=
170 | LARAVEL_LOGGER_ACTIVITY_MODEL=jeremykenedy\LaravelLogger\App\Models\Activity
171 | LARAVEL_LOGGER_USER_MODEL=App\User
172 | LARAVEL_LOGGER_USER_ID_FIELD=id
173 | LARAVEL_LOGGER_DISABLE_ROUTES=false
174 | LARAVEL_LOGGER_PAGINATION_ENABLED=true
175 | LARAVEL_LOGGER_CURSOR_PAGINATION_ENABLED=false
176 | LARAVEL_LOGGER_PAGINATION_PER_PAGE=25
177 | LARAVEL_LOGGER_DATATABLES_ENABLED=true
178 | LARAVEL_LOGGER_ENABLE_SEARCH=true
179 | LARAVEL_LOGGER_SEARCH_FIELDS=description,user,method,route,ip
180 | LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED=true
181 | LARAVEL_LOGGER_DASHBOARD_DRILLABLE=true
182 | LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE=true
183 | LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED=true
184 | LARAVEL_LOGGER_LAYOUT=layouts.app
185 | LARAVEL_LOGGER_BOOTSTRAP_VERSION=4
186 | LARAVEL_LOGGER_BLADE_PLACEMENT=stack #option: yield or stack
187 | LARAVEL_LOGGER_BLADE_PLACEMENT_CSS=css-header #placement name
188 | LARAVEL_LOGGER_BLADE_PLACEMENT_JS=scripts-footer #placement name
189 | LARAVEL_LOGGER_JQUERY_CDN_ENABLED=true
190 | LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
191 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
192 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
193 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
194 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
195 | LARAVEL_LOGGER_POPPER_JS_CDN_ENABLED=true
196 | LARAVEL_LOGGER_POPPER_JS_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js
197 | LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
198 | LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
199 | ```
200 |
201 | ### Usage
202 |
203 | ##### Middleware Usage
204 | Events for laravel authentication scaffolding are listened for as providers and are enabled via middleware.
205 | You can add events to your routes and controllers via the middleware:
206 |
207 | ```php
208 | activity
209 | ```
210 |
211 | Example to start recording page views using middlware in `web.php`:
212 |
213 | ```php
214 | Route::group(['middleware' => ['web', 'activity']], function () {
215 | Route::get('/', 'WelcomeController@welcome')->name('welcome');
216 | });
217 | ```
218 |
219 | This middlware can be enabled/disabled in the configuration settings.
220 |
221 | ##### Trait Usage
222 | Events can be recorded directly by using the trait.
223 | When using the trait you can customize the event description.
224 |
225 | To use the trait:
226 | 1. Include the call in the head of your class file:
227 |
228 | ```php
229 | use jeremykenedy\LaravelLogger\App\Http\Traits\ActivityLogger;
230 | ```
231 |
232 | 2. Include the trait call in the opening of your class:
233 |
234 | ```php
235 | use ActivityLogger;
236 | ```
237 |
238 | 3. You can record the activity by calling the traits method:
239 | ```
240 | ActivityLogger::activity("Logging this activity.");
241 | ```
242 |
243 | Or as bellow to include extended activity details:
244 | ```
245 | ActivityLogger::activity("Logging this activity.", "Additional activity details.");
246 | ```
247 |
248 | Or even including the model related to the activity:
249 | ```
250 | ActivityLogger::activity("Logging this activity.", "Additional activity details.", ["id" => 1, "model" => "App\Models\User"]);
251 | ```
252 |
253 | ### Routes
254 | ##### Laravel Activity Dashbaord Routes
255 |
256 | * ```/activity```
257 | * ```/activity/cleared```
258 | * ```/activity/log/{id}```
259 | * ```/activity/cleared/log/{id}```
260 |
261 | #### Custom package routes
262 | If you wish to change the route paths, names or other options you can disable the default routes in your `.env` file by setting
263 | ```dotenv
264 | LARAVEL_LOGGER_DISABLE_ROUTES=true
265 | ```
266 |
267 | If you are on an existing install, you will also need update your `laravel-logger.php` config file to add the config option:
268 | ```php
269 | 'disableRoutes' => env('LARAVEL_LOGGER_DISABLE_ROUTES', false),
270 | ```
271 |
272 | You can then add the routes directly to your application's `routes/web.php` file, and customise as required.
273 |
274 | ```php
275 | Route::group(['prefix' => 'activity', 'namespace' => 'jeremykenedy\LaravelLogger\App\Http\Controllers', 'middleware' => ['web', 'auth', 'activity']], function () {
276 |
277 | // Dashboards
278 | Route::get('/', 'LaravelLoggerController@showAccessLog')->name('activity');
279 | Route::get('/cleared', ['uses' => 'LaravelLoggerController@showClearedActivityLog'])->name('cleared');
280 |
281 | // Drill Downs
282 | Route::get('/log/{id}', 'LaravelLoggerController@showAccessLogEntry');
283 | Route::get('/cleared/log/{id}', 'LaravelLoggerController@showClearedAccessLogEntry');
284 |
285 | // Forms
286 | Route::delete('/clear-activity', ['uses' => 'LaravelLoggerController@clearActivityLog'])->name('clear-activity');
287 | Route::delete('/destroy-activity', ['uses' => 'LaravelLoggerController@destroyActivityLog'])->name('destroy-activity');
288 | Route::post('/restore-log', ['uses' => 'LaravelLoggerController@restoreClearedActivityLog'])->name('restore-activity');
289 | });
290 | ```
291 |
292 | ### Search
293 |
294 | adding dynamic search fields (description , user, URL , method and ip address)
295 |
296 | ### High Performance Paginator
297 |
298 | When dealing with millions activity records, default behavior of not paginate records or [Laravel's paginator](https://laravel.com/docs/pagination#paginating-eloquent-results) (enabled `LARAVEL_LOGGER_PAGINATION_ENABLED=true`) may lead to huge performance penalties. For that use case you may set `LARAVEL_LOGGER_CURSOR_PAGINATION_ENABLED=true` to enable [Laravel's Cursor Pagination](https://laravel.com/docs/pagination#cursor-pagination) feature. This will heavily improve Laravel Logger page loading time. If you choose to do so it's advisable to read [Cursor vs. Offset Pagination](https://laravel.com/docs/pagination#cursor-vs-offset-pagination) section on Laravel's documentation to get acquainted with Cursor Pagination limitations.
299 |
300 | ##### .env file
301 | add these configurations to your .env file to control the logging search
302 | ```
303 | LARAVEL_LOGGER_ENABLE_SEARCH=true
304 | // you can customize your search using these options [description,user,method,route,ip]
305 | LARAVEL_LOGGER_SEARCH_FIELDS=description,user,method,route,ip
306 | ```
307 | by default all search fields are enabled when you enable the search with this one line configuration
308 | ```
309 | LARAVEL_LOGGER_SEARCH_ENABLE=true
310 | ```
311 |
312 | ### Screenshots
313 | 
314 | 
315 | 
316 | 
317 | 
318 | 
319 | 
320 | 
321 | 
322 | 
323 |
324 | ### File Tree
325 |
326 | ```bash
327 | ├── .env.travis
328 | ├── .gitignore
329 | ├── .travis.yml
330 | ├── CODE_OF_CONDUCT.md
331 | ├── LICENSE
332 | ├── README.md
333 | ├── composer.json
334 | └── src
335 | ├── .env.example
336 | ├── LaravelLoggerServiceProvider.php
337 | ├── app
338 | │ ├── Http
339 | │ │ ├── Controllers
340 | │ │ │ └── LaravelLoggerController.php
341 | │ │ ├── Middleware
342 | │ │ │ └── LogActivity.php
343 | │ │ └── Traits
344 | │ │ ├── ActivityLogger.php
345 | │ │ ├── IpAddressDetails.php
346 | │ │ └── UserAgentDetails.php
347 | │ ├── Listeners
348 | │ │ ├── LogAuthenticated.php
349 | │ │ ├── LogAuthenticationAttempt.php
350 | │ │ ├── LogFailedLogin.php
351 | │ │ ├── LogLockout.php
352 | │ │ ├── LogPasswordReset.php
353 | │ │ ├── LogSuccessfulLogin.php
354 | │ │ └── LogSuccessfulLogout.php
355 | │ ├── Logic
356 | │ │ └── helpers.php
357 | │ └── Models
358 | │ └── Activity.php
359 | ├── config
360 | │ └── laravel-logger.php
361 | ├── database
362 | │ └── migrations
363 | │ └── 2017_11_04_103444_create_laravel_logger_activity_table.php
364 | ├── resources
365 | │ ├── lang
366 | │ │ ├── de
367 | │ │ │ └── laravel-logger.php
368 | │ │ └── en
369 | │ │ └── laravel-logger.php
370 | │ └── views
371 | │ ├── forms
372 | │ │ ├── clear-activity-log.blade.php
373 | │ │ ├── delete-activity-log.blade.php
374 | │ │ └── restore-activity-log.blade.php
375 | │ ├── logger
376 | │ │ ├── activity-log-cleared.blade.php
377 | │ │ ├── activity-log-item.blade.php
378 | │ │ ├── activity-log.blade.php
379 | │ │ └── partials
380 | │ │ └── activity-table.blade.php
381 | │ ├── modals
382 | │ │ └── confirm-modal.blade.php
383 | │ ├── partials
384 | │ │ ├── form-search.blade.php
385 | │ │ ├── form-status.blade.php
386 | │ │ ├── scripts.blade.php
387 | │ │ └── styles.blade.php
388 | │ └── scripts
389 | │ ├── add-title-attribute.blade.php
390 | │ ├── clickable-row.blade.php
391 | │ ├── confirm-modal.blade.php
392 | │ ├── datatables.blade.php
393 | │ └── tooltip.blade.php
394 | └── routes
395 | └── web.php
396 | ```
397 |
398 | * Tree command can be installed using brew: `brew install tree`
399 | * File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests'`
400 |
401 | ### Opening an Issue
402 | Before opening an issue there are a couple of considerations:
403 | * You are all awesome!
404 | * **Read the instructions** and make sure all steps were *followed correctly*.
405 | * **Check** that the issue is not *specific to your development environment* setup.
406 | * **Provide** *duplication steps*.
407 | * **Attempt to look into the issue**, and if you *have a solution, make a pull request*.
408 | * **Show that you have made an attempt** to *look into the issue*.
409 | * **Check** to see if the issue you are *reporting is a duplicate* of a previous reported issue.
410 | * **Following these instructions show me that you have tried.**
411 | * If you have a questions send me an email to jeremykenedy@gmail.com
412 | * Need some help, I can do my best on Slack: https://opensourcehelpgroup.slack.com
413 | * Please be considerate that this is an open source project that I provide to the community for FREE when opening an issue.
414 |
415 | ### License
416 | Laravel-logger is licensed under the MIT license. Enjoy!
417 |
418 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jeremykenedy/laravel-logger",
3 | "description": "Laravel Logger Package",
4 | "keywords": [
5 | "Laravel activity",
6 | "Laravel activity logger",
7 | "Laravel activity log",
8 | "Laravel logger",
9 | "Laravel log"
10 | ],
11 | "license": "MIT",
12 | "type": "package",
13 | "authors": [
14 | {
15 | "name": "jeremykenedy",
16 | "email": "jeremykenedy@gmail.com"
17 | }
18 | ],
19 | "minimum-stability": "dev",
20 | "require": {
21 | "php": ">=7.3.0|^8.0",
22 | "jaybizzle/laravel-crawler-detect": "1.*"
23 | },
24 | "autoload": {
25 | "psr-4": {
26 | "jeremykenedy\\LaravelLogger\\": "src/"
27 | },
28 | "files": [
29 | "src/App/Logic/helpers.php"
30 | ]
31 | },
32 | "extra": {
33 | "laravel": {
34 | "providers": [
35 | "jeremykenedy\\LaravelLogger\\LaravelLoggerServiceProvider"
36 | ]
37 | }
38 | },
39 | "config": {
40 | "sort-packages": true
41 | },
42 | "minimum-stability": "stable"
43 | }
44 |
--------------------------------------------------------------------------------
/src/.env.example:
--------------------------------------------------------------------------------
1 | LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
2 | LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
3 | LARAVEL_LOGGER_ROLES_ENABLED=true
4 | LARAVEL_LOGGER_ROLES_MIDDLWARE=role:admin
5 | LARAVEL_LOGGER_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
6 | LARAVEL_LOGGER_MIDDLEWARE_ENABLED=true
7 | LARAVEL_LOGGER_MIDDLEWARE_EXCEPT=ignore1pattern1,ignorepattern2
8 | LARAVEL_LOGGER_USER_MODEL=App\Models\User
9 | LARAVEL_LOGGER_USER_ID_FIELD=id
10 | LARAVEL_LOGGER_DISABLE_ROUTES=false
11 | LARAVEL_LOGGER_PAGINATION_ENABLED=true
12 | LARAVEL_LOGGER_PAGINATION_PER_PAGE=25
13 | LARAVEL_LOGGER_DATATABLES_ENABLED=true
14 | LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED=true
15 | LARAVEL_LOGGER_DASHBOARD_DRILLABLE=true
16 | LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE=true
17 | LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED=true
18 | LARAVEL_LOGGER_JQUERY_CDN_ENABLED=true
19 | LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
20 | LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
21 | LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
22 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
23 | LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
24 | LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
25 | LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
26 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
27 | LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
28 | LARAVEL_LOGGER_POPPER_JS_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js
29 | LARAVEL_LOGGER_BLADE_PLACEMENT=yield
30 | LARAVEL_LOGGER_BLADE_PLACEMENT_CSS=template_linked_css
31 | LARAVEL_LOGGER_BLADE_PLACEMENT_JS=footer_scripts
32 |
--------------------------------------------------------------------------------
/src/App/Http/Controllers/LaravelLoggerController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
32 |
33 | $this->_rolesEnabled = config('LaravelLogger.rolesEnabled');
34 | $this->_rolesMiddlware = config('LaravelLogger.rolesMiddlware');
35 |
36 | if ($this->_rolesEnabled) {
37 | $this->middleware($this->_rolesMiddlware);
38 | }
39 | }
40 |
41 | /**
42 | * Add additional details to a collections.
43 | *
44 | * @param collection $collectionItems
45 | *
46 | * @return collection
47 | */
48 | private function mapAdditionalDetails($collectionItems)
49 | {
50 | $collectionItems->map(function ($collectionItem) {
51 | $eventTime = Carbon::parse($collectionItem->updated_at);
52 | $collectionItem['timePassed'] = $eventTime->diffForHumans();
53 | $collectionItem['userAgentDetails'] = UserAgentDetails::details($collectionItem->userAgent);
54 | $collectionItem['langDetails'] = UserAgentDetails::localeLang($collectionItem->locale);
55 | $collectionItem['userDetails'] = config('LaravelLogger.defaultUserModel')::find($collectionItem->userId);
56 |
57 | return $collectionItem;
58 | });
59 |
60 | return $collectionItems;
61 | }
62 |
63 | /**
64 | * Show the activities log dashboard.
65 | *
66 | * @return \Illuminate\Http\Response
67 | */
68 | public function showAccessLog(Request $request)
69 | {
70 | if (config('LaravelLogger.loggerCursorPaginationEnabled')) {
71 | $activities = config('LaravelLogger.defaultActivityModel')::orderBy('created_at', 'desc');
72 | if (config('LaravelLogger.enableSearch')) {
73 | $activities = $this->searchActivityLog($activities, $request);
74 | }
75 | $activities = $activities->cursorPaginate(config('LaravelLogger.loggerPaginationPerPage'))->withQueryString();
76 | $totalActivities = 0;
77 | } elseif (config('LaravelLogger.loggerPaginationEnabled')) {
78 | $activities = config('LaravelLogger.defaultActivityModel')::orderBy('created_at', 'desc');
79 | if (config('LaravelLogger.enableSearch')) {
80 | $activities = $this->searchActivityLog($activities, $request);
81 | }
82 | $activities = $activities->paginate(config('LaravelLogger.loggerPaginationPerPage'))->withQueryString();
83 | $totalActivities = $activities->total();
84 | } else {
85 | $activities = config('LaravelLogger.defaultActivityModel')::orderBy('created_at', 'desc');
86 | if (config('LaravelLogger.enableSearch')) {
87 | $activities = $this->searchActivityLog($activities, $request);
88 | }
89 | $activities = $activities->get();
90 | $totalActivities = $activities->count();
91 | }
92 |
93 | self::mapAdditionalDetails($activities);
94 |
95 | if (config('LaravelLogger.enableLiveSearch')) {
96 | // We are querying only the paginated userIds because in a big application querying all user data is performance heavy
97 | $user_ids = array_unique($activities->pluck('userId')->toArray());
98 | $users = config('LaravelLogger.defaultUserModel')::whereIn(config('LaravelLogger.defaultUserIDField'), $user_ids)->get();
99 | } else {
100 | $users = config('LaravelLogger.defaultUserModel')::all();
101 | }
102 |
103 | $data = [
104 | 'activities' => $activities,
105 | 'totalActivities' => $totalActivities,
106 | 'users' => $users,
107 | ];
108 |
109 | return View('LaravelLogger::logger.activity-log', $data);
110 | }
111 |
112 | /**
113 | * Show an individual activity log entry.
114 | *
115 | * @param Request $request
116 | * @param int $id
117 | *
118 | * @return \Illuminate\Http\Response
119 | */
120 | public function showAccessLogEntry(Request $request, $id)
121 | {
122 | $activity = config('LaravelLogger.defaultActivityModel')::findOrFail($id);
123 |
124 | $userDetails = config('LaravelLogger.defaultUserModel')::find($activity->userId);
125 | $userAgentDetails = UserAgentDetails::details($activity->userAgent);
126 | $ipAddressDetails = IpAddressDetails::checkIP($activity->ipAddress);
127 | $langDetails = UserAgentDetails::localeLang($activity->locale);
128 | $eventTime = Carbon::parse($activity->created_at);
129 | $timePassed = $eventTime->diffForHumans();
130 |
131 | if (config('LaravelLogger.loggerCursorPaginationEnabled')) {
132 | $userActivities = config('LaravelLogger.defaultActivityModel')::where('userId', $activity->userId)
133 | ->orderBy('created_at', 'desc')
134 | ->cursorPaginate(config('LaravelLogger.loggerPaginationPerPage'));
135 | $totalUserActivities = 0;
136 | } elseif (config('LaravelLogger.loggerPaginationEnabled')) {
137 | $userActivities = config('LaravelLogger.defaultActivityModel')::where('userId', $activity->userId)
138 | ->orderBy('created_at', 'desc')
139 | ->paginate(config('LaravelLogger.loggerPaginationPerPage'));
140 | $totalUserActivities = $userActivities->total();
141 | } else {
142 | $userActivities = config('LaravelLogger.defaultActivityModel')::where('userId', $activity->userId)
143 | ->orderBy('created_at', 'desc')
144 | ->get();
145 | $totalUserActivities = $userActivities->count();
146 | }
147 |
148 | self::mapAdditionalDetails($userActivities);
149 |
150 | $data = [
151 | 'activity' => $activity,
152 | 'userDetails' => $userDetails,
153 | 'ipAddressDetails' => $ipAddressDetails,
154 | 'timePassed' => $timePassed,
155 | 'userAgentDetails' => $userAgentDetails,
156 | 'langDetails' => $langDetails,
157 | 'userActivities' => $userActivities,
158 | 'totalUserActivities' => $totalUserActivities,
159 | 'isClearedEntry' => false,
160 | ];
161 |
162 | return View('LaravelLogger::logger.activity-log-item', $data);
163 | }
164 |
165 | /**
166 | * Remove the specified resource from storage.
167 | *
168 | * @param Request $request
169 | *
170 | * @return \Illuminate\Http\Response
171 | */
172 | public function clearActivityLog(Request $request)
173 | {
174 | $activities = config('LaravelLogger.defaultActivityModel')::all();
175 | foreach ($activities as $activity) {
176 | $activity->delete();
177 | }
178 |
179 | return redirect('activity')->with('success', trans('LaravelLogger::laravel-logger.messages.logClearedSuccessfuly'));
180 | }
181 |
182 | /**
183 | * Show the cleared activity log - softdeleted records.
184 | *
185 | * @return \Illuminate\Http\Response
186 | */
187 | public function showClearedActivityLog()
188 | {
189 | if (config('LaravelLogger.loggerCursorPaginationEnabled')) {
190 | $activities = config('LaravelLogger.defaultActivityModel')::onlyTrashed()
191 | ->orderBy('created_at', 'desc')
192 | ->paginate(config('LaravelLogger.loggerPaginationPerPage'));
193 | $totalActivities = 0;
194 | } elseif (config('LaravelLogger.loggerPaginationEnabled')) {
195 | $activities = config('LaravelLogger.defaultActivityModel')::onlyTrashed()
196 | ->orderBy('created_at', 'desc')
197 | ->paginate(config('LaravelLogger.loggerPaginationPerPage'));
198 | $totalActivities = $activities->total();
199 | } else {
200 | $activities = config('LaravelLogger.defaultActivityModel')::onlyTrashed()
201 | ->orderBy('created_at', 'desc')
202 | ->get();
203 | $totalActivities = $activities->count();
204 | }
205 |
206 | self::mapAdditionalDetails($activities);
207 |
208 | $data = [
209 | 'activities' => $activities,
210 | 'totalActivities' => $totalActivities,
211 | ];
212 |
213 | return View('LaravelLogger::logger.activity-log-cleared', $data);
214 | }
215 |
216 | /**
217 | * Show an individual cleared (soft deleted) activity log entry.
218 | *
219 | * @param Request $request
220 | * @param int $id
221 | *
222 | * @return \Illuminate\Http\Response
223 | */
224 | public function showClearedAccessLogEntry(Request $request, $id)
225 | {
226 | $activity = self::getClearedActvity($id);
227 |
228 | $userDetails = config('LaravelLogger.defaultUserModel')::find($activity->userId);
229 | $userAgentDetails = UserAgentDetails::details($activity->userAgent);
230 | $ipAddressDetails = IpAddressDetails::checkIP($activity->ipAddress);
231 | $langDetails = UserAgentDetails::localeLang($activity->locale);
232 | $eventTime = Carbon::parse($activity->created_at);
233 | $timePassed = $eventTime->diffForHumans();
234 |
235 | $data = [
236 | 'activity' => $activity,
237 | 'userDetails' => $userDetails,
238 | 'ipAddressDetails' => $ipAddressDetails,
239 | 'timePassed' => $timePassed,
240 | 'userAgentDetails' => $userAgentDetails,
241 | 'langDetails' => $langDetails,
242 | 'isClearedEntry' => true,
243 | ];
244 |
245 | return View('LaravelLogger::logger.activity-log-item', $data);
246 | }
247 |
248 | /**
249 | * Get Cleared (Soft Deleted) Activity - Helper Method.
250 | *
251 | * @param int $id
252 | *
253 | * @return \Illuminate\Http\Response
254 | */
255 | private static function getClearedActvity($id)
256 | {
257 | $activity = config('LaravelLogger.defaultActivityModel')::onlyTrashed()->where('id', $id)->get();
258 | if (count($activity) != 1) {
259 | return abort(404);
260 | }
261 |
262 | return $activity[0];
263 | }
264 |
265 | /**
266 | * Destroy the specified resource from storage.
267 | *
268 | * @param Request $request
269 | *
270 | * @return \Illuminate\Http\Response
271 | */
272 | public function destroyActivityLog(Request $request)
273 | {
274 | $activities = config('LaravelLogger.defaultActivityModel')::onlyTrashed()->get();
275 | foreach ($activities as $activity) {
276 | $activity->forceDelete();
277 | }
278 |
279 | return redirect('activity')->with('success', trans('LaravelLogger::laravel-logger.messages.logDestroyedSuccessfuly'));
280 | }
281 |
282 | /**
283 | * Restore the specified resource from soft deleted storage.
284 | *
285 | * @param Request $request
286 | *
287 | * @return \Illuminate\Http\Response
288 | */
289 | public function restoreClearedActivityLog(Request $request)
290 | {
291 | $activities = config('LaravelLogger.defaultActivityModel')::onlyTrashed()->get();
292 | foreach ($activities as $activity) {
293 | $activity->restore();
294 | }
295 |
296 | return redirect('activity')->with('success', trans('LaravelLogger::laravel-logger.messages.logRestoredSuccessfuly'));
297 | }
298 |
299 | /**
300 | * Search the activity log according to specific criteria.
301 | *
302 | * @param query
303 | * @param request
304 | *
305 | * @return filtered query
306 | */
307 | public function searchActivityLog($query, $request)
308 | {
309 | if (in_array('description', explode(',', config('LaravelLogger.searchFields'))) && $request->get('description')) {
310 | $query->where('description', 'like', '%'.$request->get('description').'%');
311 | }
312 |
313 | if (in_array('user', explode(',', config('LaravelLogger.searchFields'))) && (int) $request->get('user')) {
314 | $query->where('userId', '=', (int) $request->get('user'));
315 | }
316 |
317 | if (in_array('method', explode(',', config('LaravelLogger.searchFields'))) && $request->get('method')) {
318 | $query->where('methodType', '=', $request->get('method'));
319 | }
320 |
321 | if (in_array('route', explode(',', config('LaravelLogger.searchFields'))) && $request->get('route')) {
322 | $query->where('route', 'like', '%'.$request->get('route').'%');
323 | }
324 |
325 | if (in_array('ip', explode(',', config('LaravelLogger.searchFields'))) && $request->get('ip_address')) {
326 | $query->where('ipAddress', 'like', '%'.$request->get('ip_address').'%');
327 | }
328 |
329 | return $query;
330 | }
331 |
332 | /**
333 | * Search the database users according to specific criteria.
334 | *
335 | * @param request
336 | *
337 | * @return filtered user data
338 | */
339 | public function liveSearch(Request $request)
340 | {
341 | $filteredUsers = config('LaravelLogger.defaultUserModel')::when(request('userid'), function ($q) {
342 | return $q->where(config('LaravelLogger.defaultUserIDField'), (int) request('userid', 0));
343 | })->when(request('email'), function ($q) {
344 | return $q->where('email', 'like', '%'.request('email').'%');
345 | });
346 |
347 | return response()->json($filteredUsers->get()->pluck('email', config('LaravelLogger.defaultUserIDField')), 200);
348 | }
349 | }
350 |
--------------------------------------------------------------------------------
/src/App/Http/Middleware/LogActivity.php:
--------------------------------------------------------------------------------
1 | shouldLog($request)) {
24 | $this->activity($description);
25 | }
26 |
27 | return $next($request);
28 | }
29 |
30 | /**
31 | * Determine if the request has a URI that should log.
32 | *
33 | * @param \Illuminate\Http\Request $request
34 | *
35 | * @return bool
36 | */
37 | protected function shouldLog($request)
38 | {
39 | foreach (config('LaravelLogger.loggerMiddlewareExcept', []) as $except) {
40 | if ($except !== '/') {
41 | $except = trim($except, '/');
42 | }
43 |
44 | if ($request->is($except)) {
45 | return false;
46 | }
47 | }
48 |
49 | return true;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/App/Http/Traits/ActivityLogger.php:
--------------------------------------------------------------------------------
1 | {$userIdField};
31 | }
32 |
33 | if (Crawler::isCrawler()) {
34 | $userType = trans('LaravelLogger::laravel-logger.userTypes.crawler');
35 | if (is_null($description)) {
36 | $description = $userType.' '.trans('LaravelLogger::laravel-logger.verbTypes.crawled').' '.Request::fullUrl();
37 | }
38 | }
39 |
40 | if (!$description) {
41 | switch (strtolower(Request::method())) {
42 | case 'post':
43 | $verb = trans('LaravelLogger::laravel-logger.verbTypes.created');
44 | break;
45 |
46 | case 'patch':
47 | case 'put':
48 | $verb = trans('LaravelLogger::laravel-logger.verbTypes.edited');
49 | break;
50 |
51 | case 'delete':
52 | $verb = trans('LaravelLogger::laravel-logger.verbTypes.deleted');
53 | break;
54 |
55 | case 'get':
56 | default:
57 | $verb = trans('LaravelLogger::laravel-logger.verbTypes.viewed');
58 | break;
59 | }
60 |
61 | $description = $verb.' '.Request::path();
62 | }
63 |
64 | if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
65 | $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
66 | } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
67 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
68 | } else {
69 | $ip = Request::ip();
70 | }
71 |
72 | $relId = null;
73 | $relModel = null;
74 | if (is_array($rel) && array_key_exists('id', $rel) && array_key_exists('model', $rel)) {
75 | $relId = $rel['id'];
76 | $relModel = $rel['model'];
77 | }
78 |
79 | $data = [
80 | 'description' => $description,
81 | 'details' => $details,
82 | 'userType' => $userType,
83 | 'userId' => $userId,
84 | 'route' => Request::fullUrl(),
85 | 'ipAddress' => $ip,
86 | 'userAgent' => Request::header('user-agent'),
87 | 'locale' => Request::header('accept-language'),
88 | 'referer' => Request::header('referer'),
89 | 'methodType' => Request::method(),
90 | 'relId' => $relId,
91 | 'relModel' => $relModel,
92 | ];
93 |
94 | // Validation Instance
95 | $validator = Validator::make($data, config('LaravelLogger.defaultActivityModel')::rules());
96 | if ($validator->fails()) {
97 | $errors = self::prepareErrorMessage($validator->errors(), $data);
98 | if (config('LaravelLogger.logDBActivityLogFailuresToFile')) {
99 | Log::error('Failed to record activity event. Failed Validation: '.$errors);
100 | }
101 | } else {
102 | self::storeActivity($data);
103 | }
104 | }
105 |
106 | /**
107 | * Store activity entry to database.
108 | *
109 | * @param array $data
110 | *
111 | * @return void
112 | */
113 | private static function storeActivity($data)
114 | {
115 | config('LaravelLogger.defaultActivityModel')::create([
116 | 'description' => $data['description'],
117 | 'details' => $data['details'],
118 | 'userType' => $data['userType'],
119 | 'userId' => $data['userId'],
120 | 'route' => $data['route'],
121 | 'ipAddress' => $data['ipAddress'],
122 | 'userAgent' => $data['userAgent'],
123 | 'locale' => $data['locale'],
124 | 'referer' => $data['referer'],
125 | 'methodType' => $data['methodType'],
126 | 'relId' => $data['relId'],
127 | 'relModel' => $data['relModel'],
128 | ]);
129 | }
130 |
131 | /**
132 | * Prepare Error Message (add the actual value of the error field).
133 | *
134 | * @param $validator
135 | * @param $data
136 | *
137 | * @return string
138 | */
139 | private static function prepareErrorMessage($validatorErrors, $data)
140 | {
141 | $errors = json_decode(json_encode($validatorErrors, true));
142 | array_walk($errors, function (&$value, $key) use ($data) {
143 | array_push($value, "Value: $data[$key]");
144 | });
145 |
146 | return json_encode($errors, true);
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/src/App/Http/Traits/IpAddressDetails.php:
--------------------------------------------------------------------------------
1 | 'Africa',
34 | 'AN' => 'Antarctica',
35 | 'AS' => 'Asia',
36 | 'EU' => 'Europe',
37 | 'OC' => 'Australia (Oceania)',
38 | 'NA' => 'North America',
39 | 'SA' => 'South America',
40 | ];
41 | if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) {
42 | $ipdat = @json_decode(file_get_contents('http://www.geoplugin.net/json.gp?ip='.$ip));
43 | if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) {
44 | switch ($purpose) {
45 | case 'location':
46 | $output = [
47 | 'city' => @$ipdat->geoplugin_city,
48 | 'state' => @$ipdat->geoplugin_regionName,
49 | 'country' => @$ipdat->geoplugin_countryName,
50 | 'countryCode' => @$ipdat->geoplugin_countryCode,
51 | 'continent' => @$continents[strtoupper($ipdat->geoplugin_continentCode)],
52 | 'continent_code' => @$ipdat->geoplugin_continentCode,
53 | 'latitude' => @$ipdat->geoplugin_latitude,
54 | 'longitude' => @$ipdat->geoplugin_longitude,
55 | 'currencyCode' => @$ipdat->geoplugin_currencyCode,
56 | 'areaCode' => @$ipdat->geoplugin_areaCode,
57 | 'dmaCode' => @$ipdat->geoplugin_dmaCode,
58 | 'region' => @$ipdat->geoplugin_region,
59 | ];
60 | break;
61 | case 'address':
62 | $address = [$ipdat->geoplugin_countryName];
63 | if (@strlen($ipdat->geoplugin_regionName) >= 1) {
64 | $address[] = $ipdat->geoplugin_regionName;
65 | }
66 | if (@strlen($ipdat->geoplugin_city) >= 1) {
67 | $address[] = $ipdat->geoplugin_city;
68 | }
69 | $output = implode(', ', array_reverse($address));
70 | break;
71 | case 'city':
72 | $output = @$ipdat->geoplugin_city;
73 | break;
74 | case 'state':
75 | $output = @$ipdat->geoplugin_regionName;
76 | break;
77 | case 'region':
78 | $output = @$ipdat->geoplugin_regionName;
79 | break;
80 | case 'country':
81 | $output = @$ipdat->geoplugin_countryName;
82 | break;
83 | case 'countrycode':
84 | $output = @$ipdat->geoplugin_countryCode;
85 | break;
86 | }
87 | }
88 | }
89 |
90 | return $output;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/App/Http/Traits/UserAgentDetails.php:
--------------------------------------------------------------------------------
1 | 1) {
40 | $return['platform'] = $ua_array[0]; // Windows / iPad / MacOS / BlackBerry
41 | $return['type'] = $ua_array[1]; // Mozilla / Opera etc.
42 | $return['renderer'] = $ua_array[2]; // WebKit / Presto / Trident / Gecko etc.
43 | $return['browser'] = $ua_array[3]; // Chrome / Safari / MSIE / Firefox
44 |
45 | /*
46 | Not necessary but this will filter out Chromes ridiculously long version
47 | numbers 31.0.1234.122 becomes 31.0, while a "normal" 3 digit version number
48 | like 10.2.1 would stay 10.2.1, 11.0 stays 11.0. Non-match stays what it is.
49 | */
50 | if (preg_match("/^[\d]+\.[\d]+(?:\.[\d]{0,2}$)?/", $ua_array[4], $matches)) {
51 | $return['version'] = $matches[0];
52 | } else {
53 | $return['version'] = $ua_array[4];
54 | }
55 | } else {
56 | $return['platform'] = '-';
57 | $return['type'] = '-';
58 | $return['renderer'] = '-';
59 | $return['browser'] = '-';
60 | $return['version'] = '-';
61 | }
62 |
63 | // Replace some browsernames e.g. MSIE -> Internet Explorer
64 | switch (strtolower($return['browser'])) {
65 | case 'msie':
66 | case 'trident':
67 | $return['browser'] = 'Internet Explorer';
68 | break;
69 | case '': // IE 11 is a steamy turd (thanks Microsoft...)
70 | if (strtolower($return['renderer']) == 'trident') {
71 | $return['browser'] = 'Internet Explorer';
72 | }
73 | break;
74 | }
75 |
76 | switch (strtolower($return['platform'])) {
77 | case 'android': // These browsers claim to be Safari but are BB Mobile
78 | case 'blackberry': // and Android Mobile
79 | if ($return['browser'] == 'Safari' || $return['browser'] == 'Mobile' || $return['browser'] == '') {
80 | $return['browser'] = "{$return['platform']} mobile";
81 | }
82 | break;
83 | }
84 |
85 | return $return;
86 | }
87 |
88 | /**
89 | * Return the locales language from PHP's Local
90 | * http://php.net/manual/en/class.locale.php
91 | * http://php.net/manual/en/locale.acceptfromhttp.php.
92 | *
93 | * @param string $locale :: LIKE "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3" > return 'fr-FR';
94 | * Fallback if No Locale CLASS @sudwebdesign
95 | *
96 | * @return string (Example: "en_US")
97 | */
98 | public static function localeLang($locale)
99 | {
100 | if (class_exists('Locale')) {
101 | return \Locale::acceptFromHttp($locale);
102 | }
103 |
104 | $a = explode(',', $locale);
105 | $a = $a ?? explode(';', $a[1]);
106 |
107 | return $a[0];
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogAuthenticated.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.auth'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogAuthenticationAttempt.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.attempt'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogFailedLogin.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.failed'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogLockout.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.lockout'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogPasswordReset.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.reset'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogSuccessfulLogin.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.login'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Listeners/LogSuccessfulLogout.php:
--------------------------------------------------------------------------------
1 | activity(trans('LaravelLogger::laravel-logger.listenerTypes.logout'));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/App/Logic/helpers.php:
--------------------------------------------------------------------------------
1 | 'datetime',
67 | 'updated_at' => 'datetime',
68 | 'deleted_at' => 'datetime',
69 | 'description' => 'string',
70 | 'details' => 'string',
71 | 'user' => 'integer',
72 | 'route' => 'string',
73 | 'ipAddress' => 'string',
74 | 'userAgent' => 'string',
75 | 'locale' => 'string',
76 | 'referer' => 'string',
77 | 'methodType' => 'string',
78 | ];
79 |
80 | /**
81 | * Create a new instance to set the table and connection.
82 | *
83 | * @return void
84 | */
85 | public function __construct($attributes = [])
86 | {
87 | parent::__construct($attributes);
88 | $this->table = config('LaravelLogger.loggerDatabaseTable');
89 | $this->connection = config('LaravelLogger.loggerDatabaseConnection');
90 | }
91 |
92 | /**
93 | * Get the database connection.
94 | */
95 | public function getConnectionName()
96 | {
97 | return $this->connection;
98 | }
99 |
100 | /**
101 | * Get the database connection.
102 | */
103 | public function getTableName()
104 | {
105 | return $this->table;
106 | }
107 |
108 | /**
109 | * An activity has a user.
110 | *
111 | * @var array
112 | */
113 | public function user()
114 | {
115 | return $this->hasOne(config('LaravelLogger.defaultUserModel'));
116 | }
117 |
118 | /**
119 | * Get a validator for an incoming Request.
120 | *
121 | * @param array $merge (rules to optionally merge)
122 | *
123 | * @return array
124 | */
125 | public static function rules($merge = [])
126 | {
127 | if (app() instanceof \Illuminate\Foundation\Application) {
128 | $route_url_check = version_compare(\Illuminate\Foundation\Application::VERSION, '5.8') < 0 ? 'active_url' : 'url';
129 | } else {
130 | $route_url_check = 'url';
131 | }
132 |
133 | return array_merge(
134 | [
135 | 'description' => 'required|string',
136 | 'details' => 'nullable|string',
137 | 'userType' => 'required|string',
138 | 'userId' => 'nullable|integer',
139 | 'route' => 'nullable|'.$route_url_check,
140 | 'ipAddress' => 'nullable|ip',
141 | 'userAgent' => 'nullable|string',
142 | 'locale' => 'nullable|string',
143 | 'referer' => 'nullable|string',
144 | 'methodType' => 'nullable|string',
145 | ],
146 | $merge
147 | );
148 | }
149 |
150 | /**
151 | * User Agent Parsing Helper.
152 | *
153 | * @return string
154 | */
155 | public function getUserAgentDetailsAttribute()
156 | {
157 | return \jeremykenedy\LaravelLogger\App\Http\Traits\UserAgentDetails::details($this->userAgent);
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/src/LaravelLoggerServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
29 | 'jeremykenedy\LaravelLogger\App\Listeners\LogAuthenticationAttempt',
30 | ],
31 |
32 | 'Illuminate\Auth\Events\Authenticated' => [
33 | 'jeremykenedy\LaravelLogger\App\Listeners\LogAuthenticated',
34 | ],
35 |
36 | 'Illuminate\Auth\Events\Login' => [
37 | 'jeremykenedy\LaravelLogger\App\Listeners\LogSuccessfulLogin',
38 | ],
39 |
40 | 'Illuminate\Auth\Events\Failed' => [
41 | 'jeremykenedy\LaravelLogger\App\Listeners\LogFailedLogin',
42 | ],
43 |
44 | 'Illuminate\Auth\Events\Logout' => [
45 | 'jeremykenedy\LaravelLogger\App\Listeners\LogSuccessfulLogout',
46 | ],
47 |
48 | 'Illuminate\Auth\Events\Lockout' => [
49 | 'jeremykenedy\LaravelLogger\App\Listeners\LogLockout',
50 | ],
51 |
52 | 'Illuminate\Auth\Events\PasswordReset' => [
53 | 'jeremykenedy\LaravelLogger\App\Listeners\LogPasswordReset',
54 | ],
55 |
56 | ];
57 |
58 | /**
59 | * Bootstrap the application services.
60 | *
61 | * @return void
62 | */
63 | public function boot(Router $router)
64 | {
65 | $router->middlewareGroup('activity', [LogActivity::class]);
66 | $this->loadTranslationsFrom(__DIR__.'/resources/lang/', 'LaravelLogger');
67 | }
68 |
69 | /**
70 | * Register the application services.
71 | *
72 | * @return void
73 | */
74 | public function register()
75 | {
76 | if (file_exists(config_path('laravel-logger.php'))) {
77 | $this->mergeConfigFrom(config_path('laravel-logger.php'), 'LaravelLogger');
78 | } else {
79 | $this->mergeConfigFrom(__DIR__.'/config/laravel-logger.php', 'LaravelLogger');
80 | }
81 |
82 | if (config(self::DISABLE_DEFAULT_ROUTES_CONFIG) == false) {
83 | $this->loadRoutesFrom(__DIR__.'/routes/web.php');
84 | }
85 |
86 | $this->loadViewsFrom(__DIR__.'/resources/views/', 'LaravelLogger');
87 | $this->loadMigrationsFrom(__DIR__.'/database/migrations');
88 |
89 | $this->registerEventListeners();
90 | $this->publishFiles();
91 | }
92 |
93 | /**
94 | * Get the list of listeners and events.
95 | *
96 | * @return array
97 | */
98 | private function getListeners()
99 | {
100 | return $this->listeners;
101 | }
102 |
103 | /**
104 | * Register the list of listeners and events.
105 | *
106 | * @return void
107 | */
108 | private function registerEventListeners()
109 | {
110 | $listeners = $this->getListeners();
111 | foreach ($listeners as $listenerKey => $listenerValues) {
112 | foreach ($listenerValues as $listenerValue) {
113 | Event::listen(
114 | $listenerKey,
115 | $listenerValue
116 | );
117 | }
118 | }
119 | }
120 |
121 | /**
122 | * Publish files for Laravel Logger.
123 | *
124 | * @return void
125 | */
126 | private function publishFiles()
127 | {
128 | $publishTag = 'LaravelLogger';
129 |
130 | $this->publishes([
131 | __DIR__.'/config/laravel-logger.php' => base_path('config/laravel-logger.php'),
132 | ], $publishTag);
133 |
134 | $this->publishes([
135 | __DIR__.'/resources/views' => base_path('resources/views/vendor/'.$publishTag),
136 | ], $publishTag);
137 |
138 | $this->publishes([
139 | __DIR__.'/resources/lang' => base_path('resources/lang/vendor/'.$publishTag),
140 | ], $publishTag);
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/config/laravel-logger.php:
--------------------------------------------------------------------------------
1 | env('LARAVEL_LOGGER_DATABASE_CONNECTION', env('DB_CONNECTION', 'mysql')),
12 | 'loggerDatabaseTable' => env('LARAVEL_LOGGER_DATABASE_TABLE', 'laravel_logger_activity'),
13 |
14 | /*
15 | |--------------------------------------------------------------------------
16 | | Laravel Logger Roles Settings - (laravel roles not required if false)
17 | |--------------------------------------------------------------------------
18 | */
19 |
20 | 'rolesEnabled' => env('LARAVEL_LOGGER_ROLES_ENABLED', false),
21 | 'rolesMiddlware' => env('LARAVEL_LOGGER_ROLES_MIDDLWARE', 'role:admin'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Enable/Disable Laravel Logger Middlware
26 | |--------------------------------------------------------------------------
27 | */
28 |
29 | 'loggerMiddlewareEnabled' => env('LARAVEL_LOGGER_MIDDLEWARE_ENABLED', true),
30 | 'loggerMiddlewareExcept' => array_filter(explode(',', trim((string) env('LARAVEL_LOGGER_MIDDLEWARE_EXCEPT') ?? ''))),
31 |
32 | /*
33 | |--------------------------------------------------------------------------
34 | | Laravel Logger Authentication Listeners Enable/Disable
35 | |--------------------------------------------------------------------------
36 | */
37 | 'logAllAuthEvents' => false, // May cause a lot of duplication.
38 | 'logAuthAttempts' => false, // Successful and Failed - May cause a lot of duplication.
39 | 'logFailedAuthAttempts' => true, // Failed Logins
40 | 'logLockOut' => true, // Account Lockout
41 | 'logPasswordReset' => true, // Password Resets
42 | 'logSuccessfulLogin' => true, // Successful Login
43 | 'logSuccessfulLogout' => true, // Successful Logout
44 |
45 | /*
46 | |--------------------------------------------------------------------------
47 | | Laravel Logger Search Enable/Disable
48 | |--------------------------------------------------------------------------
49 | */
50 | 'enableSearch' => env('LARAVEL_LOGGER_ENABLE_SEARCH', 'false'),
51 |
52 | /*
53 | |--------------------------------------------------------------------------
54 | | Laravel Logger Search Parameters
55 | |--------------------------------------------------------------------------
56 | */
57 | // you can add or remove from these options [description,user,method,route,ip]
58 | 'searchFields' => env('LARAVEL_LOGGER_SEARCH_FIELDS', 'description,user,method,route,ip'),
59 |
60 | /*
61 | |--------------------------------------------------------------------------
62 | | Laravel Default Models
63 | |--------------------------------------------------------------------------
64 | */
65 |
66 | 'defaultActivityModel' => env('LARAVEL_LOGGER_ACTIVITY_MODEL', 'jeremykenedy\LaravelLogger\App\Models\Activity'),
67 | 'defaultUserModel' => env('LARAVEL_LOGGER_USER_MODEL', 'App\User'),
68 |
69 | /*
70 | |--------------------------------------------------------------------------
71 | | Laravel Default User ID Field
72 | |--------------------------------------------------------------------------
73 | */
74 |
75 | 'defaultUserIDField' => env('LARAVEL_LOGGER_USER_ID_FIELD', 'id'),
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Disable automatic Laravel Logger routes
80 | | If you want to customise the routes the package uses, set this to true.
81 | | For more information, see the README.
82 | |--------------------------------------------------------------------------
83 | */
84 |
85 | 'disableRoutes' => env('LARAVEL_LOGGER_DISABLE_ROUTES', false),
86 |
87 | /*
88 | |--------------------------------------------------------------------------
89 | | Laravel Logger Pagination Settings
90 | |--------------------------------------------------------------------------
91 | */
92 | 'loggerPaginationEnabled' => env('LARAVEL_LOGGER_PAGINATION_ENABLED', true),
93 | 'loggerCursorPaginationEnabled' => env('LARAVEL_LOGGER_CURSOR_PAGINATION_ENABLED', false),
94 | 'loggerPaginationPerPage' => env('LARAVEL_LOGGER_PAGINATION_PER_PAGE', 25),
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Laravel Logger Databales Settings - Not recommended with pagination.
99 | |--------------------------------------------------------------------------
100 | */
101 |
102 | 'loggerDatatables' => env('LARAVEL_LOGGER_DATATABLES_ENABLED', false),
103 | 'loggerDatatablesCSScdn' => 'https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css',
104 | 'loggerDatatablesJScdn' => 'https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js',
105 | 'loggerDatatablesJSVendorCdn' => 'https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js',
106 |
107 | /*
108 | |--------------------------------------------------------------------------
109 | | Laravel Logger Dashboard Settings
110 | |--------------------------------------------------------------------------
111 | */
112 |
113 | 'enableSubMenu' => env('LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED', true),
114 | 'enableDrillDown' => env('LARAVEL_LOGGER_DASHBOARD_DRILLABLE', true),
115 |
116 | /*
117 | |--------------------------------------------------------------------------
118 | | Laravel Logger Failed to Log Settings
119 | |--------------------------------------------------------------------------
120 | */
121 |
122 | 'logDBActivityLogFailuresToFile' => env('LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE', true),
123 |
124 | /*
125 | |--------------------------------------------------------------------------
126 | | Laravel Logger Flash Messages
127 | |--------------------------------------------------------------------------
128 | */
129 |
130 | 'enablePackageFlashMessageBlade' => env('LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED', true),
131 |
132 | /*
133 | |--------------------------------------------------------------------------
134 | | Blade settings
135 | |--------------------------------------------------------------------------
136 | */
137 |
138 | // The parent Blade file
139 | 'loggerBladeExtended' => env('LARAVEL_LOGGER_LAYOUT', 'layouts.app'),
140 |
141 | // Switch Between bootstrap 3 `panel` and bootstrap 4 `card` classes
142 | 'bootstapVersion' => env('LARAVEL_LOGGER_BOOTSTRAP_VERSION', '4'),
143 |
144 | // Additional Card classes for styling -
145 | // See: https://getbootstrap.com/docs/4.0/components/card/#background-and-color
146 | // Example classes: 'text-white bg-primary mb-3'
147 | 'bootstrapCardClasses' => '',
148 |
149 | // Blade Extension Placement
150 | 'bladePlacement' => env('LARAVEL_LOGGER_BLADE_PLACEMENT', 'yield'),
151 | 'bladePlacementCss' => env('LARAVEL_LOGGER_BLADE_PLACEMENT_CSS', 'template_linked_css'),
152 | 'bladePlacementJs' => env('LARAVEL_LOGGER_BLADE_PLACEMENT_JS', 'footer_scripts'),
153 |
154 | /*
155 | |--------------------------------------------------------------------------
156 | | Laravel Logger Dependencies - allows for easier builds into other projects
157 | |--------------------------------------------------------------------------
158 | */
159 |
160 | // jQuery
161 | 'enablejQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_ENABLED', true),
162 | 'JQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-3.2.1.slim.min.js'),
163 |
164 | // Bootstrap
165 | 'enableBootstrapCssCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED', true),
166 | 'bootstrapCssCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css'),
167 | 'enableBootstrapJsCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED', true),
168 | 'bootstrapJsCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js'),
169 | 'enablePopperJsCDN' => env('LARAVEL_LOGGER_POPPER_JS_CDN_ENABLED', true),
170 | 'popperJsCDN' => env('LARAVEL_LOGGER_POPPER_JS_CDN_URL', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js'),
171 |
172 | // Font Awesome
173 | 'enableFontAwesomeCDN' => env('LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED', true),
174 | 'fontAwesomeCDN' => env('LARAVEL_LOGGER_FONT_AWESOME_CDN_URL', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'),
175 |
176 | // LiveSearch for scalability
177 | 'enableLiveSearch' => env('LARAVEL_LOGGER_LIVE_SEARCH_ENABLED', true),
178 |
179 | ];
180 |
--------------------------------------------------------------------------------
/src/database/migrations/2017_11_04_103444_create_laravel_logger_activity_table.php:
--------------------------------------------------------------------------------
1 | getConnectionName();
19 | $table = $activity->getTableName();
20 | $tableCheck = Schema::connection($connection)->hasTable($table);
21 |
22 | if (!$tableCheck) {
23 | Schema::connection($connection)->create($table, function (Blueprint $table) {
24 | $table->increments('id');
25 | $table->longText('description');
26 | $table->longText('details')->nullable();
27 | $table->string('userType');
28 | $table->integer('userId')->nullable();
29 | $table->longText('route')->nullable();
30 | $table->ipAddress('ipAddress')->nullable();
31 | $table->text('userAgent')->nullable();
32 | $table->string('locale')->nullable();
33 | $table->longText('referer')->nullable();
34 | $table->string('methodType')->nullable();
35 | $table->unsignedBigInteger('relId')->index()->nullable();
36 | $table->string('relModel')->nullable();
37 | $table->timestamps();
38 | $table->softDeletes();
39 | });
40 | }
41 | }
42 |
43 | /**
44 | * Reverse the migrations.
45 | *
46 | * @return void
47 | */
48 | public function down()
49 | {
50 | $activity = new Activity();
51 | $connection = $activity->getConnectionName();
52 | $table = $activity->getTableName();
53 |
54 | Schema::connection($connection)->dropIfExists($table);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/resources/lang/de/laravel-logger.php:
--------------------------------------------------------------------------------
1 | [
11 | 'guest' => 'Gast',
12 | 'registered' => 'Registriert',
13 | 'crawler' => 'Suchmaschine',
14 | ],
15 |
16 | 'verbTypes' => [
17 | 'created' => 'Erstellt',
18 | 'edited' => 'Bearbeitet',
19 | 'deleted' => 'Gelöscht',
20 | 'viewed' => 'Angesehen',
21 | 'crawled' => 'Gesucht (Crwaler)',
22 | ],
23 |
24 | 'tooltips' => [
25 | 'viewRecord' => 'Details anzeigen',
26 | ],
27 |
28 | /*
29 | |--------------------------------------------------------------------------
30 | | Laravel Logger Admin Dashboard Language Lines
31 | |--------------------------------------------------------------------------
32 | */
33 | 'dashboard' => [
34 | 'title' => 'Aktivitätslog',
35 | 'subtitle' => 'Ereignisse',
36 |
37 | 'labels' => [
38 | 'id' => 'ID',
39 | 'time' => 'Zeit',
40 | 'description' => 'Beschreibung',
41 | 'user' => 'Nutzer',
42 | 'method' => 'Methode',
43 | 'route' => 'Route',
44 | 'ipAddress' => 'IP ',
45 | 'agent' => ' Agent',
46 | 'deleteDate' => 'Deleted ',
47 | ],
48 |
49 | 'menu' => [
50 | 'alt' => 'Aktivitätslog Menü',
51 | 'clear' => 'Lösche Aktivitätslog',
52 | 'show' => 'Zeige gelöschte Logs',
53 | 'back' => 'Zurück zum Log',
54 | ],
55 |
56 | 'search' => [
57 | 'all' => 'All',
58 | 'search' => 'Suche',
59 | ],
60 | ],
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Laravel Logger Admin Drilldown Language Lines
65 | |--------------------------------------------------------------------------
66 | */
67 |
68 | 'drilldown' => [
69 | 'title' => 'Aktivitätslog :id',
70 | 'title-details' => 'Aktivitätsdetails',
71 | 'title-ip-details' => 'IP Informationen',
72 | 'title-user-details' => 'Nutzer Informationen',
73 | 'title-user-activity' => 'Nutzer Aktivität',
74 |
75 | 'buttons' => [
76 | 'back' => 'Aktivitätslog',
77 | ],
78 |
79 | 'labels' => [
80 | 'userRoles' => 'Nutzerrolle',
81 | 'userLevel' => 'Level',
82 | ],
83 |
84 | 'list-group' => [
85 | 'labels' => [
86 | 'id' => 'Aktivitätslog ID:',
87 | 'ip' => 'IP Adresse',
88 | 'description' => 'Beschreibung',
89 | 'details' => 'Einzelheiten',
90 | 'userType' => 'Nutzertyp',
91 | 'userId' => 'Nutzer ID',
92 | 'route' => 'Route',
93 | 'agent' => 'User Agent',
94 | 'locale' => 'Sprache',
95 | 'referer' => 'Referer (Ursprung)',
96 |
97 | 'methodType' => 'Methoden Typus',
98 | 'createdAt' => 'Ereignisausführung',
99 | 'updatedAt' => 'Bearbeitet am',
100 | 'deletedAt' => 'Gelöscht am',
101 | 'timePassed' => 'Letzte Aktivität',
102 | 'userName' => 'Nutzer',
103 | 'userFirstName' => 'Vorname',
104 | 'userLastName' => 'Nachname',
105 | 'userFulltName' => 'Name',
106 | 'userEmail' => 'Email',
107 | 'userSignupIp' => 'Anmelde Ip',
108 | 'userCreatedAt' => 'Erstellt',
109 | 'userUpdatedAt' => 'Bearbeitet',
110 | ],
111 |
112 | 'fields' => [
113 | 'none' => 'Keiner',
114 | ],
115 | ],
116 |
117 | ],
118 |
119 | /*
120 | |--------------------------------------------------------------------------
121 | | Laravel Logger Modals
122 | |--------------------------------------------------------------------------
123 | */
124 |
125 | 'modals' => [
126 | 'shared' => [
127 | 'btnCancel' => 'Abbrechen',
128 | 'btnConfirm' => 'Bestätigen',
129 | ],
130 | 'clearLog' => [
131 | 'title' => 'Lösche Aktivitätslog',
132 | 'message' => 'Sind Sie sicher, dass Sie das Aktivitätslog löschen möchten?',
133 | ],
134 | 'deleteLog' => [
135 | 'title' => 'Unwiederbringliches Löschen des Aktivitätslogs',
136 | 'message' => 'Sind Sie sicher, dass Sie das Aktivitätslog löschen möchten?',
137 | ],
138 | 'restoreLog' => [
139 | 'title' => 'Wiederherstellen des Aktivitätslogs',
140 | 'message' => 'Sind Sie sicher, dass Sie das Aktivitätslog wiederherstellen möchten?',
141 | ],
142 | ],
143 |
144 | /*
145 | |--------------------------------------------------------------------------
146 | | Laravel Logger Flash Messages
147 | |--------------------------------------------------------------------------
148 | */
149 |
150 | 'messages' => [
151 | 'logClearedSuccessfuly' => 'Aktivitätslog erfolgreich geleert',
152 | 'logDestroyedSuccessfuly' => 'Aktivitätslog erfolgreich gelöscht',
153 | 'logRestoredSuccessfuly' => 'Aktivitätslog erfolgreich wiederhergestellt',
154 | ],
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | Laravel Logger Cleared Dashboard Language Lines
159 | |--------------------------------------------------------------------------
160 | */
161 |
162 | 'dashboardCleared' => [
163 | 'title' => 'Gelöschte Aktivitäten',
164 | 'subtitle' => 'Gelöschte Ereignisse',
165 |
166 | 'menu' => [
167 | 'deleteAll' => 'Lösche alle Aktivitäten',
168 | 'restoreAll' => 'Aktivitäten wiederherstellen',
169 | ],
170 | ],
171 |
172 | /*
173 | |--------------------------------------------------------------------------
174 | | Laravel Logger Pagination Language Lines
175 | |--------------------------------------------------------------------------
176 | */
177 | 'pagination' => [
178 | 'countText' => 'Zeige :firstItem - :lastItem von :total Einträgen (:perPage je Seite)',
179 | ],
180 |
181 | ];
182 |
--------------------------------------------------------------------------------
/src/resources/lang/en/laravel-logger.php:
--------------------------------------------------------------------------------
1 | [
11 | 'guest' => 'Guest',
12 | 'registered' => 'Registered',
13 | 'crawler' => 'Crawler',
14 | ],
15 |
16 | 'verbTypes' => [
17 | 'created' => 'Created',
18 | 'edited' => 'Edited',
19 | 'deleted' => 'Deleted',
20 | 'viewed' => 'Viewed',
21 | 'crawled' => 'crawled',
22 | ],
23 |
24 | 'listenerTypes' => [
25 | 'auth' => 'Authenticated Activity',
26 | 'attempt' => 'Authenticated Attempt',
27 | 'failed' => 'Failed Login Attempt',
28 | 'lockout' => 'Locked Out',
29 | 'reset' => 'Reset Password',
30 | 'login' => 'Logged In',
31 | 'logout' => 'Logged Out',
32 | ],
33 |
34 | 'tooltips' => [
35 | 'viewRecord' => 'View Record Details',
36 | ],
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Laravel Logger Admin Dashboard Language Lines
41 | |--------------------------------------------------------------------------
42 | */
43 | 'dashboard' => [
44 | 'title' => 'Activity Log',
45 | 'subtitle' => 'Events',
46 |
47 | 'labels' => [
48 | 'id' => 'Id',
49 | 'time' => 'Time',
50 | 'description' => 'Description',
51 | 'user' => 'User',
52 | 'method' => 'Method',
53 | 'route' => 'Route',
54 | 'ipAddress' => 'Ip ',
55 | 'agent' => ' Agent',
56 | 'deleteDate' => ' Deleted',
57 | ],
58 |
59 | 'menu' => [
60 | 'alt' => 'Activity Log Menu',
61 | 'clear' => 'Clear Activity Log',
62 | 'show' => 'Show Cleared Logs',
63 | 'back' => 'Back to Activity Log',
64 | ],
65 |
66 | 'search' => [
67 | 'all' => 'All',
68 | 'search' => 'Search',
69 | ],
70 | ],
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | Laravel Logger Admin Drilldown Language Lines
75 | |--------------------------------------------------------------------------
76 | */
77 |
78 | 'drilldown' => [
79 | 'title' => 'Activity Log :id',
80 | 'title-details' => 'Activity Details',
81 | 'title-ip-details' => 'Ip Address Details',
82 | 'title-user-details' => 'User Details',
83 | 'title-user-activity' => 'Additional User Activity',
84 |
85 | 'buttons' => [
86 | 'back' => 'Activity Log',
87 | ],
88 |
89 | 'labels' => [
90 | 'userRoles' => 'User Roles',
91 | 'userLevel' => 'Level',
92 | ],
93 |
94 | 'list-group' => [
95 | 'labels' => [
96 | 'id' => 'Activity Log ID:',
97 | 'ip' => 'Ip Address',
98 | 'description' => 'Description',
99 | 'details' => 'Details',
100 | 'userType' => 'User Type',
101 | 'userId' => 'User Id',
102 | 'route' => 'Route',
103 | 'agent' => 'User Agent',
104 | 'locale' => 'Locale',
105 | 'referer' => 'Referer',
106 |
107 | 'methodType' => 'Method Type',
108 | 'createdAt' => 'Event Time',
109 | 'updatedAt' => 'Updated At',
110 | 'deletedAt' => 'Deleted At',
111 | 'timePassed' => 'Time Passed',
112 | 'userName' => 'Username',
113 | 'userFirstName' => 'First Name',
114 | 'userLastName' => 'Last Name',
115 | 'userFulltName' => 'Full Name',
116 | 'userEmail' => 'User Email',
117 | 'userSignupIp' => 'Signup Ip',
118 | 'userCreatedAt' => 'Created',
119 | 'userUpdatedAt' => 'Updated',
120 | ],
121 |
122 | 'fields' => [
123 | 'none' => 'None',
124 | ],
125 | ],
126 |
127 | ],
128 |
129 | /*
130 | |--------------------------------------------------------------------------
131 | | Laravel Logger Modals
132 | |--------------------------------------------------------------------------
133 | */
134 |
135 | 'modals' => [
136 | 'shared' => [
137 | 'btnCancel' => 'Cancel',
138 | 'btnConfirm' => 'Confirm',
139 | ],
140 | 'clearLog' => [
141 | 'title' => 'Clear Activity Log',
142 | 'message' => 'Are you sure you want to clear the activity log?',
143 | ],
144 | 'deleteLog' => [
145 | 'title' => 'Permanently Delete Activity Log',
146 | 'message' => 'Are you sure you want to permanently DELETE the activity log?',
147 | ],
148 | 'restoreLog' => [
149 | 'title' => 'Restore Cleared Activity Log',
150 | 'message' => 'Are you sure you want to restore the cleared activity logs?',
151 | ],
152 | ],
153 |
154 | /*
155 | |--------------------------------------------------------------------------
156 | | Laravel Logger Flash Messages
157 | |--------------------------------------------------------------------------
158 | */
159 |
160 | 'messages' => [
161 | 'logClearedSuccessfuly' => 'Activity log cleared successfully',
162 | 'logDestroyedSuccessfuly' => 'Activity log deleted successfully',
163 | 'logRestoredSuccessfuly' => 'Activity log restored successfully',
164 | ],
165 |
166 | /*
167 | |--------------------------------------------------------------------------
168 | | Laravel Logger Cleared Dashboard Language Lines
169 | |--------------------------------------------------------------------------
170 | */
171 |
172 | 'dashboardCleared' => [
173 | 'title' => 'Cleared Activity Logs',
174 | 'subtitle' => 'Cleared Events',
175 |
176 | 'menu' => [
177 | 'deleteAll' => 'Delete All Activity Logs',
178 | 'restoreAll' => 'Restore All Activity Logs',
179 | ],
180 | ],
181 |
182 | /*
183 | |--------------------------------------------------------------------------
184 | | Laravel Logger Pagination Language Lines
185 | |--------------------------------------------------------------------------
186 | */
187 | 'pagination' => [
188 | 'countText' => 'Showing :firstItem - :lastItem of :total results (:perPage per page)',
189 | ],
190 |
191 | ];
192 |
--------------------------------------------------------------------------------
/src/resources/lang/fr/laravel-logger.php:
--------------------------------------------------------------------------------
1 | [
11 | 'guest' => 'Anonyme',
12 | 'registered' => 'Membre',
13 | 'crawler' => 'Robot', //extracteur
14 | ],
15 |
16 | 'verbTypes' => [
17 | 'created' => 'Créé',
18 | 'edited' => 'Édition',
19 | 'deleted' => 'Supprimé',
20 | 'viewed' => 'Vu',
21 | 'crawled' => 'Visité', //trainé
22 | ],
23 |
24 | 'tooltips' => [
25 | 'viewRecord' => 'Voir les détails de cet Enregistrement',
26 | ],
27 |
28 | /*
29 | |--------------------------------------------------------------------------
30 | | Laravel Logger Admin Dashboard Language Lines
31 | |--------------------------------------------------------------------------
32 | */
33 | 'dashboard' => [
34 | 'title' => 'Journal des Activités',
35 | 'subtitle' => 'Événements',
36 | 'labels' => [
37 | 'id' => 'Événement Id',
38 | 'time' => 'Temps',
39 | 'description' => 'Description',
40 | 'user' => 'Utilisateur',
41 | 'method' => 'Méthode',
42 | 'route' => 'Route',
43 | 'ipAddress' => ' Ip',
44 | 'agent' => 'Agent ',
45 | 'deleteDate' => 'Supprimé ',
46 | ],
47 |
48 | 'menu' => [
49 | 'alt' => 'Menu du Journal des Activités',
50 | 'clear' => 'Éffacer le jounal',
51 | 'show' => 'Afficher les journaux effacés',
52 | 'back' => 'Retour au Journal des Activités',
53 | ],
54 |
55 | 'search' => [
56 | 'all' => 'Tous',
57 | 'search' => 'Chercher',
58 | ],
59 | ],
60 |
61 | /*
62 | |--------------------------------------------------------------------------
63 | | Laravel Logger Admin Drilldown Language Lines
64 | |--------------------------------------------------------------------------
65 | */
66 |
67 | 'drilldown' => [
68 | 'title' => 'Activité',
69 | 'title-details' => 'Détails',
70 | 'title-ip-details' => 'Adresse Ip',
71 | 'title-user-details' => 'Utilisateur',
72 | 'title-user-activity' => 'Activité Utilisateur supplémentaire',
73 | 'buttons' => [
74 | 'back' => ' Journal des Activitées',
75 | ],
76 |
77 | 'labels' => [
78 | 'userRoles' => 'Rôles',
79 | 'userNiveau' => 'Niveau',
80 | ],
81 |
82 | 'list-group' => [
83 | 'labels' => [
84 | 'id' => 'Activité Id :',
85 | 'ip' => 'Adresse Ip',
86 | 'description' => 'Description',
87 | 'details' => 'Détails',
88 | 'userType' => 'Type Utilisateur',
89 | 'userId' => 'Id Utilisateur',
90 | 'route' => 'Route',
91 | 'agent' => 'Agent utilisateur',
92 | 'locale' => 'Lieu',
93 | 'referer' => 'Référant',
94 |
95 | 'methodType' => 'Type de méthode',
96 | 'createdAt' => 'Événement', //Event Time
97 | 'updatedAt' => 'Actualisé le',
98 | 'deletedAt' => 'Éffacé le',
99 | 'timePassed' => 'Temps écoulé',
100 | 'userName' => 'Pseudonyme',
101 | 'userFirstName' => 'Prénom',
102 | 'userLastName' => 'Nom de famille',
103 | 'userFulltName' => 'Nom complet',
104 | 'userEmail' => 'Courriel',
105 | 'userSignupIp' => 'Inscription Ip',
106 | 'userCreatedAt' => 'Créé le',
107 | 'userUpdatedAt' => 'Actualisé le',
108 | ],
109 |
110 | 'fields' => [
111 | 'none' => 'Aucun',
112 | ],
113 | ],
114 |
115 | ],
116 |
117 | /*
118 | |--------------------------------------------------------------------------
119 | | Laravel Logger Modals
120 | |--------------------------------------------------------------------------
121 | */
122 |
123 | 'modals' => [
124 | 'shared' => [
125 | 'btnCancel' => 'Annuler',
126 | 'btnConfirm' => 'Confirmer',
127 | ],
128 | 'clearLog' => [
129 | 'title' => 'Effacer le Journal des Activités',
130 | 'message' => 'Êtes-vous sûr de vouloir effacer le journal des activités ?',
131 | ],
132 | 'deleteLog' => [
133 | 'title' => 'Supprimer définitivement le journal des activités',
134 | 'message' => 'Êtes-vous sûr de vouloir SUPPRIMER de façon permanente le journal des activités ?',
135 | ],
136 | 'restoreLog' => [
137 | 'title' => 'Restaurer le journal des activités effacé',
138 | 'message' => 'Êtes-vous sûr de vouloir restaurer le journal des activités effacés ?',
139 | ],
140 | ],
141 |
142 | /*
143 | |--------------------------------------------------------------------------
144 | | Laravel Logger Flash Messages
145 | |--------------------------------------------------------------------------
146 | */
147 |
148 | 'messages' => [
149 | 'logClearedSuccessfuly' => 'Activité effacé avec succès',
150 | 'logDestroyedSuccessfuly' => 'Activité supprimé avec succès',
151 | 'logRestoredSuccessfuly' => 'Activité restauré avec succès',
152 | ],
153 |
154 | /*
155 | |--------------------------------------------------------------------------
156 | | Laravel Logger Cleared Dashboard Language Lines
157 | |--------------------------------------------------------------------------
158 | */
159 |
160 | 'dashboardCleared' => [
161 | 'title' => 'Journal des activités effacées',
162 | 'subtitle' => 'Événements effacés',
163 |
164 | 'menu' => [
165 | 'deleteAll' => 'Supprimer tous les Journaux des activitéss',
166 | 'restoreAll' => 'Restaurer tous les journaux des activités',
167 | ],
168 | ],
169 |
170 | /*
171 | |--------------------------------------------------------------------------
172 | | Laravel Logger Pagination Language Lines
173 | |--------------------------------------------------------------------------
174 | */
175 | 'pagination' => [
176 | 'countText' => 'Affichage de :firstItem - :lastItem sur :total resultats (:perPage par page)',
177 | ],
178 |
179 | ];
180 |
--------------------------------------------------------------------------------
/src/resources/lang/pt-br/laravel-logger.php:
--------------------------------------------------------------------------------
1 | [
11 | 'guest' => 'Não-registrado',
12 | 'registered' => 'Registrado',
13 | 'crawler' => 'Rastreador',
14 | ],
15 |
16 | 'verbTypes' => [
17 | 'created' => 'Criou',
18 | 'edited' => 'Editou',
19 | 'deleted' => 'Excluiu',
20 | 'viewed' => 'Visualizou',
21 | 'crawled' => 'Rastreou',
22 | ],
23 |
24 | 'listenerTypes' => [
25 | 'auth' => 'Ação de Autenticação',
26 | 'attempt' => 'Tentativa de Autenticação',
27 | 'failed' => 'Falhou na Tentativa de Login',
28 | 'lockout' => 'Bloqueado',
29 | 'reset' => 'Redefiniu Senha',
30 | 'login' => 'Acessou o sistema',
31 | 'logout' => 'Saiu do sistema',
32 | ],
33 |
34 | 'tooltips' => [
35 | 'viewRecord' => 'Ver Detalhes do Registro',
36 | ],
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Laravel Logger Admin Dashboard Language Lines
41 | |--------------------------------------------------------------------------
42 | */
43 | 'dashboard' => [
44 | 'title' => 'Registro de Ações',
45 | 'subtitle' => 'Eventos',
46 |
47 | 'labels' => [
48 | 'id' => 'Id',
49 | 'time' => 'Tempo',
50 | 'description' => 'Descrição',
51 | 'user' => 'Usuário',
52 | 'method' => 'Método HTTP',
53 | 'route' => 'Rota',
54 | 'ipAddress' => 'Endereço ',
55 | 'agent' => ' Usuário',
56 | 'deleteDate' => ' Exclusão',
57 | ],
58 |
59 | 'menu' => [
60 | 'alt' => 'Menu do Registro de Ações',
61 | 'clear' => 'Remover Registros de Ações',
62 | 'show' => 'Mostrar Registros Removidos',
63 | 'back' => 'Voltar para o Registro de Ações',
64 | ],
65 |
66 | 'search' => [
67 | 'all' => 'Todos',
68 | 'search' => 'Pesquisar',
69 | ],
70 | ],
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | Laravel Logger Admin Drilldown Language Lines
75 | |--------------------------------------------------------------------------
76 | */
77 |
78 | 'drilldown' => [
79 | 'title' => 'Registro de Ações :id',
80 | 'title-details' => 'Detalhes de Ações',
81 | 'title-ip-details' => 'Detalhes de Endereço de IP',
82 | 'title-user-details' => 'Detalhes de Usuário',
83 | 'title-user-activity' => 'Ações Adicionais de Usuário',
84 |
85 | 'buttons' => [
86 | 'back' => 'Registro de Ações',
87 | ],
88 |
89 | 'labels' => [
90 | 'userRoles' => 'Funções de Usuário',
91 | 'userLevel' => 'Nível',
92 | ],
93 |
94 | 'list-group' => [
95 | 'labels' => [
96 | 'id' => 'Registro de Ações ID:',
97 | 'ip' => 'Endereço IP',
98 | 'description' => 'Descrição',
99 | 'details' => 'Detalhes',
100 | 'userType' => 'Tipo de Usuário',
101 | 'userId' => 'Id de Usuário',
102 | 'route' => 'Rota',
103 | 'agent' => 'Agente de Usuário',
104 | 'locale' => 'Local',
105 | 'referer' => 'Referenciador',
106 |
107 | 'methodType' => 'Tipo de Método',
108 | 'createdAt' => 'Criado Em',
109 | 'updatedAt' => 'Atualizado Em',
110 | 'deletedAt' => 'Excluído Em',
111 | 'timePassed' => 'Tempo passado',
112 | 'userName' => 'Nome de Usuário',
113 | 'userFirstName' => 'Primeiro Nome',
114 | 'userLastName' => 'Sobrenome',
115 | 'userFulltName' => 'Nome Completo',
116 | 'userEmail' => 'Email de Usuário',
117 | 'userSignupIp' => 'Ip de Inscrição',
118 | 'userCreatedAt' => 'Criado',
119 | 'userUpdatedAt' => 'Atualizado',
120 | ],
121 |
122 | 'fields' => [
123 | 'none' => 'Nenhum',
124 | ],
125 | ],
126 |
127 | ],
128 |
129 | /*
130 | |--------------------------------------------------------------------------
131 | | Laravel Logger Modals
132 | |--------------------------------------------------------------------------
133 | */
134 |
135 | 'modals' => [
136 | 'shared' => [
137 | 'btnCancel' => 'Cancelar',
138 | 'btnConfirm' => 'Confirmar',
139 | ],
140 | 'clearLog' => [
141 | 'title' => 'Remover registros de Ações',
142 | 'message' => 'Você tem certeza que deseja remover os registros de ações?',
143 | ],
144 | 'deleteLog' => [
145 | 'title' => 'Excluir permanentemente o Registro de Ações',
146 | 'message' => 'Você tem certeza que deseja EXCLUIR PERMANENTEMENTE o registro de ações?',
147 | ],
148 | 'restoreLog' => [
149 | 'title' => 'Restaurar registros de ações removidos',
150 | 'message' => 'Você tem certeza que deseja restaurar os registros de ações removidos?',
151 | ],
152 | ],
153 |
154 | /*
155 | |--------------------------------------------------------------------------
156 | | Laravel Logger Flash Messages
157 | |--------------------------------------------------------------------------
158 | */
159 |
160 | 'messages' => [
161 | 'logClearedSuccessfuly' => 'Registros de ações removidos com sucesso',
162 | 'logDestroyedSuccessfuly' => 'Registros de ações excluídos com sucesso',
163 | 'logRestoredSuccessfuly' => 'Registros de ações restaurados com sucesso',
164 | ],
165 |
166 | /*
167 | |--------------------------------------------------------------------------
168 | | Laravel Logger Cleared Dashboard Language Lines
169 | |--------------------------------------------------------------------------
170 | */
171 |
172 | 'dashboardCleared' => [
173 | 'title' => 'Registros de Ações Removidos',
174 | 'subtitle' => 'Eventos Removidos',
175 |
176 | 'menu' => [
177 | 'deleteAll' => 'Remover Todos os Registros de Ações',
178 | 'restoreAll' => 'Restaurar Todos os Registros de Ações',
179 | ],
180 | ],
181 |
182 | /*
183 | |--------------------------------------------------------------------------
184 | | Laravel Logger Pagination Language Lines
185 | |--------------------------------------------------------------------------
186 | */
187 | 'pagination' => [
188 | 'countText' => 'Mostrando :firstItem - :lastItem de :total resultados (:perPage por página)',
189 | ],
190 |
191 | ];
192 |
--------------------------------------------------------------------------------
/src/resources/lang/tr/laravel-logger.php:
--------------------------------------------------------------------------------
1 | [
11 | 'guest' => 'Misafir',
12 | 'registered' => 'Kayıtlı',
13 | 'crawler' => 'Yancı',
14 | ],
15 |
16 | 'verbTypes' => [
17 | 'created' => 'Oluşturuldu',
18 | 'edited' => 'Düzenlendi',
19 | 'deleted' => 'Silindi',
20 | 'viewed' => 'Gösterildi',
21 | 'crawled' => 'crawled',
22 | ],
23 |
24 | 'tooltips' => [
25 | 'viewRecord' => 'Ayrıntıları Görüntüle',
26 | ],
27 |
28 | /*
29 | |--------------------------------------------------------------------------
30 | | Laravel Logger Admin Dashboard Language Lines
31 | |--------------------------------------------------------------------------
32 | */
33 | 'dashboard' => [
34 | 'title' => 'Aktivite Kayıtları',
35 | 'subtitle' => 'Etkinlik',
36 |
37 | 'labels' => [
38 | 'id' => 'NO',
39 | 'time' => 'Zaman',
40 | 'description' => 'Tanım',
41 | 'user' => 'Kullanıcı',
42 | 'method' => 'Method',
43 | 'route' => 'Yönlendirme',
44 | 'ipAddress' => 'IP ',
45 | 'agent' => ' Tarayıcısı',
46 | 'deleteDate' => ' Zamanı',
47 | ],
48 |
49 | 'menu' => [
50 | 'alt' => 'Aktivite kayıt menüsü',
51 | 'clear' => 'Aktivite kayıtlarını temizle',
52 | 'show' => 'Temizlenen kayıtları göster',
53 | 'back' => 'Aktivite kayıtlarına geri dön',
54 | ],
55 |
56 | 'search' => [
57 | 'all' => 'Hepsi',
58 | 'search' => 'Ara',
59 | ],
60 | ],
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Laravel Logger Admin Drilldown Language Lines
65 | |--------------------------------------------------------------------------
66 | */
67 |
68 | 'drilldown' => [
69 | 'title' => 'Aktivite NO: :id',
70 | 'title-details' => 'Aktivite detayı',
71 | 'title-ip-details' => 'IP Adres Detayı',
72 | 'title-user-details' => 'Kullanıcı Detayı',
73 | 'title-user-activity' => 'Ek Kullanıcı Etkinliği',
74 |
75 | 'buttons' => [
76 | 'back' => 'geri dön',
77 | ],
78 |
79 | 'labels' => [
80 | 'userRoles' => 'Kullanıcı Rolleri',
81 | 'userLevel' => 'Seviye',
82 | ],
83 |
84 | 'list-group' => [
85 | 'labels' => [
86 | 'id' => 'Aktivite Kayıt NO:',
87 | 'ip' => 'IP Adresi',
88 | 'description' => 'Tanım',
89 | 'details' => 'Detay',
90 | 'userType' => 'Kullanıcı Türü',
91 | 'userId' => 'Kullanıcı NO',
92 | 'route' => 'Yönlendirme',
93 | 'agent' => 'Tarayıcı',
94 | 'locale' => 'Yerel',
95 | 'referer' => 'Yönlendirilen',
96 |
97 | 'methodType' => 'Yöntem Türü',
98 | 'createdAt' => 'Etkinlik Zamanı',
99 | 'updatedAt' => 'Güncellenme',
100 | 'deletedAt' => 'Silinme',
101 | 'timePassed' => 'Zaman geçti',
102 | 'userName' => 'Kullanıcı adı',
103 | 'userFirstName' => 'AD',
104 | 'userLastName' => 'SOYAD',
105 | 'userFulltName' => 'TAM AD',
106 | 'userEmail' => 'E-Posta',
107 | 'userSignupIp' => 'Kayıt Olduğu IP',
108 | 'userCreatedAt' => 'Oluşturuldu',
109 | 'userUpdatedAt' => 'Güncellendi',
110 | ],
111 |
112 | 'fields' => [
113 | 'none' => 'Yok',
114 | ],
115 | ],
116 |
117 | ],
118 |
119 | /*
120 | |--------------------------------------------------------------------------
121 | | Laravel Logger Modals
122 | |--------------------------------------------------------------------------
123 | */
124 |
125 | 'modals' => [
126 | 'shared' => [
127 | 'btnCancel' => 'Vazgeç',
128 | 'btnConfirm' => 'Onayla',
129 | ],
130 | 'clearLog' => [
131 | 'title' => 'Etkinlik Günlüğünü Temizle',
132 | 'message' => 'Etkinlik günlüğünü temizlemek istediğinizden emin misiniz?',
133 | ],
134 | 'deleteLog' => [
135 | 'title' => 'Etkinlik Günlüğünü Kalıcı Olarak Sil',
136 | 'message' => 'Etkinlik günlüğünü kalıcı olarak SİLMEK istediğinizden emin misiniz?',
137 | ],
138 | 'restoreLog' => [
139 | 'title' => 'Temizlenen Etkinlik Günlüğünü Geri Yükle',
140 | 'message' => 'Temizlenen etkinlik günlüklerini geri yüklemek istediğinizden emin misiniz?',
141 | ],
142 | ],
143 |
144 | /*
145 | |--------------------------------------------------------------------------
146 | | Laravel Logger Flash Messages
147 | |--------------------------------------------------------------------------
148 | */
149 |
150 | 'messages' => [
151 | 'logClearedSuccessfuly' => 'Aktivite kayıtları başarıyla temizlendi',
152 | 'logDestroyedSuccessfuly' => 'Aktivite kaydı başarıyla temizlendi',
153 | 'logRestoredSuccessfuly' => 'Aktivite kaydı başarıyla yüklendi',
154 | ],
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | Laravel Logger Cleared Dashboard Language Lines
159 | |--------------------------------------------------------------------------
160 | */
161 |
162 | 'dashboardCleared' => [
163 | 'title' => 'Etkinlik kayıtları temizlendi',
164 | 'subtitle' => 'Etkinlikler temizlendi',
165 |
166 | 'menu' => [
167 | 'deleteAll' => 'Tüm aktivite kayıtlarını sil',
168 | 'restoreAll' => 'Tüm aktivite kayıtlarını yedekle',
169 | ],
170 | ],
171 |
172 | /*
173 | |--------------------------------------------------------------------------
174 | | Laravel Logger Pagination Language Lines
175 | |--------------------------------------------------------------------------
176 | */
177 | 'pagination' => [
178 | 'countText' => 'Gösteriliyor: :firstItem - :lastItem / :total kayıt (sayfa başına :perPage)',
179 | ],
180 |
181 | ];
182 |
--------------------------------------------------------------------------------
/src/resources/views/forms/clear-activity-log.blade.php:
--------------------------------------------------------------------------------
1 |
262 |
263 | Additional Ip Address Data Not Available.
264 |
23 | 24 | | 28 | 27 |29 | 30 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.time') !!} 31 | | 32 |33 | 34 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.description') !!} 35 | | 36 |37 | 38 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.user') !!} 39 | | 40 |41 | 42 | | 46 | 45 |47 | 48 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.route') !!} 49 | | 50 |51 | 52 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.ipAddress') !!} 53 | | 54 |55 | 56 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.agent') !!} 57 | | 58 | @if(request()->is('activity/cleared')) 59 |60 | 61 | {!! trans('LaravelLogger::laravel-logger.dashboard.labels.deleteDate') !!} 62 | | 63 | @endif 64 |
---|---|---|---|---|---|---|---|---|
70 | 71 | @if($hoverable) 72 | {{ $activity->id }} 73 | @else 74 | 75 | {{ $activity->id }} 76 | 77 | @endif 78 | 79 | | 80 |81 | {{ $activity->timePassed }} 82 | | 83 |84 | {{ $activity->description }} 85 | | 86 |87 | @php 88 | switch ($activity->userType) { 89 | case trans('LaravelLogger::laravel-logger.userTypes.registered'): 90 | $userTypeClass = 'success'; 91 | $userLabel = $activity->userDetails['name']; 92 | break; 93 | 94 | case trans('LaravelLogger::laravel-logger.userTypes.crawler'): 95 | $userTypeClass = 'danger'; 96 | $userLabel = $activity->userType; 97 | break; 98 | 99 | case trans('LaravelLogger::laravel-logger.userTypes.guest'): 100 | default: 101 | $userTypeClass = 'warning'; 102 | $userLabel = $activity->userType; 103 | break; 104 | } 105 | 106 | @endphp 107 | 108 | {{$userLabel}} 109 | 110 | | 111 |112 | @php 113 | switch (strtolower($activity->methodType)) { 114 | case 'get': 115 | $methodClass = 'info'; 116 | break; 117 | 118 | case 'post': 119 | $methodClass = 'warning'; 120 | break; 121 | 122 | case 'put': 123 | $methodClass = 'warning'; 124 | break; 125 | 126 | case 'delete': 127 | $methodClass = 'danger'; 128 | break; 129 | 130 | default: 131 | $methodClass = 'info'; 132 | break; 133 | } 134 | @endphp 135 | 136 | {{ $activity->methodType }} 137 | 138 | | 139 |140 | @if($hoverable) 141 | {{ showCleanRoutUrl($activity->route) }} 142 | @else 143 | 144 | {{$activity->route}} 145 | 146 | @endif 147 | | 148 |149 | {{ $activity->ipAddress }} 150 | | 151 |152 | @php 153 | $platform = $activity->userAgentDetails['platform']; 154 | $browser = $activity->userAgentDetails['browser']; 155 | $browserVersion = $activity->userAgentDetails['version']; 156 | 157 | switch ($platform) { 158 | 159 | case 'Windows': 160 | $platformIcon = 'fa-windows'; 161 | break; 162 | 163 | case 'iPad': 164 | $platformIcon = 'fa-'; 165 | break; 166 | 167 | case 'iPhone': 168 | $platformIcon = 'fa-'; 169 | break; 170 | 171 | case 'Macintosh': 172 | $platformIcon = 'fa-apple'; 173 | break; 174 | 175 | case 'Android': 176 | $platformIcon = 'fa-android'; 177 | break; 178 | 179 | case 'BlackBerry': 180 | $platformIcon = 'fa-'; 181 | break; 182 | 183 | case 'Unix': 184 | case 'Linux': 185 | $platformIcon = 'fa-linux'; 186 | break; 187 | 188 | case 'CrOS': 189 | $platformIcon = 'fa-chrome'; 190 | break; 191 | 192 | default: 193 | $platformIcon = 'fa-'; 194 | break; 195 | } 196 | 197 | switch ($browser) { 198 | 199 | case 'Chrome': 200 | $browserIcon = 'fa-chrome'; 201 | break; 202 | 203 | case 'Firefox': 204 | $browserIcon = 'fa-'; 205 | break; 206 | 207 | case 'Opera': 208 | $browserIcon = 'fa-opera'; 209 | break; 210 | 211 | case 'Safari': 212 | $browserIcon = 'fa-safari'; 213 | break; 214 | 215 | case 'Internet Explorer': 216 | $browserIcon = 'fa-edge'; 217 | break; 218 | 219 | default: 220 | $browserIcon = 'fa-'; 221 | break; 222 | } 223 | @endphp 224 | 225 | 226 | {{ $browser }} 227 | 228 | 229 | 230 | 231 | {{ $browserVersion }} 232 | 233 | 234 | 235 | 236 | {{ $platform }} 237 | 238 | 239 | 240 | 241 | {{ $activity->langDetails }} 242 | 243 | 244 | | 245 | @if(request()->is('activity/cleared')) 246 |247 | {{ $activity->deleted_at }} 248 | | 249 | @endif 250 |
268 | {!! trans('LaravelLogger::laravel-logger.pagination.countText', ['firstItem' => $activities->firstItem(), 'lastItem' => $activities->lastItem(), 'total' => $activities->total(), 'perPage' => $activities->perPage()]) !!} 269 |
270 |