Skip to content

Commit 6caa0e8

Browse files
committed
updating readme
1 parent 5b43be2 commit 6caa0e8

File tree

2 files changed

+155
-23
lines changed

2 files changed

+155
-23
lines changed

README.md

Lines changed: 155 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,38 @@
1010
- [Features](#features)
1111
- [Requirements](#requirements)
1212
- [Installation Instructions](#installation-instructions)
13+
- [Configuration](#configuration)
14+
- [Environment File](#environment-file)
15+
- [Usage](#usage)
16+
- [Authentication Middleware Usage](#authentication-middleware-usage)
17+
- [Trait Usage](#trait-usage)
18+
- [Routes](#routes)
19+
- [Screenshots](#screenshots)
20+
- [File Tree](#file-tree)
21+
- [License](#license)
22+
1323

1424
### About
1525
Laravel logger is an activity event logger for your laravel application. It comes out the box with ready to use with dashboard to view your activity. Laravel logger can be added as a middleware or called through a trait. This package is easily configurable and customizable.
1626

27+
Laravel logger can work out the box with or without the following roles packages:
28+
* [jeremykenedy/laravel-roles](https://github.com/jeremykenedy/laravel-roles)
29+
* [spatie/laravel-permission](https://github.com/spatie/laravel-permission)
30+
* [Zizaco/entrust](https://github.com/Zizaco/entrust)
31+
* [romanbican/roles](https://github.com/romanbican/roles)
32+
* [ultraware/roles](https://github.com/ultraware/roles)
33+
1734
### Features
1835

1936
| Laravel Logger Features |
2037
| :------------ |
2138
||
2239

23-
## Requirements
40+
### Requirements
2441
* [Laravel 5.1, 5.2, 5.3, 5.4, or 5.5+](https://laravel.com/docs/installation)
25-
42+
* [jaybizzle/laravel-crawler-detect](https://github.com/JayBizzle/Laravel-Crawler-Detect) included dependency in composer.json
2643

2744
### Installation Instructions
28-
2945
1. From your projects root folder in terminal run:
3046

3147
```bash
@@ -46,34 +62,163 @@ Register the package with laravel in `config/app.php` under `providers` with the
4662
];
4763
```
4864

49-
3. Publish the packages views, config file, assets, and language files by running the following from your projects root folder:
65+
3. Optionally publish the packages views, config file, assets, and language files by running the following from your projects root folder:
5066

5167
```bash
5268
php artisan vendor:publish --tag=laravellogger
5369
```
5470

71+
### Configuration
72+
Laravel Logger can be configured in directly in `/config/laravel-logger.php` if you published the assets.
73+
Or you can variables to your `.env` file.
5574

5675

76+
##### Environment File
77+
Here are the `.env` file variables available:
5778

79+
```
80+
LARAVEL_LOGGER_DATABASE_CONNECTION=mysql
81+
LARAVEL_LOGGER_DATABASE_TABLE=laravel_logger_activity
82+
LARAVEL_LOGGER_ROLES_ENABLED=true
83+
LARAVEL_LOGGER_ROLES_MIDDLWARE=role:admin
84+
LARAVEL_LOGGER_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
85+
LARAVEL_LOGGER_MIDDLEWARE_ENABLED=true
86+
LARAVEL_LOGGER_USER_MODEL=App\Models\User
87+
LARAVEL_LOGGER_PAGINATION_ENABLED=true
88+
LARAVEL_LOGGER_PAGINATION_PER_PAGE=25
89+
LARAVEL_LOGGER_DATATABLES_ENABLED=true
90+
LARAVEL_LOGGER_DASHBOARD_MENU_ENABLED=true
91+
LARAVEL_LOGGER_DASHBOARD_DRILLABLE=true
92+
LARAVEL_LOGGER_LOG_RECORD_FAILURES_TO_FILE=true
93+
LARAVEL_LOGGER_FLASH_MESSAGE_BLADE_ENABLED=true
94+
LARAVEL_LOGGER_JQUERY_CDN_ENABLED=true
95+
LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
96+
LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
97+
LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
98+
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
99+
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
100+
LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
101+
LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
102+
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
103+
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
104+
```
58105

106+
### Usage
59107

108+
##### Middleware Usage
109+
Events for laravel authentication scaffolding are listened for as providers and are enabled via middleware.
110+
You can add events to your routes and controllers via the `activity` middleware.
60111

112+
Example to start recording page views using middlware in `web.php`:
61113

114+
```
115+
Route::group(['middleware' => ['web', 'activity']], function () {
116+
Route::get('/', 'WelcomeController@welcome')->name('welcome');
117+
});
118+
```
62119

120+
This middlware can be enabled/disabled in the configuration settings.
63121

122+
##### Trait Usage
123+
Events can be recorded directly by using the trait.
124+
When using the trait you can customize the event description.
64125

126+
To use the trait:
127+
1. Include the call in the head of your class file:
128+
```
129+
use jeremykenedy\LaravelLogger\App\Http\Traits\ActivityLogger;
130+
```
65131

132+
2. Include the trait call in the opening of your class:
133+
```
134+
use ActivityLogger;
135+
```
66136

137+
3. You can record the activity my calling the traits method:
138+
```
139+
ActivityLogger::activity("Logging this activity.");
140+
```
67141

142+
### Routes
143+
##### Laravel Activity Dashbaord Routes
68144

145+
* ```/activity```
146+
* ```/activity/cleared```
147+
* ```/activity/log/{id}```
148+
* ```/activity/cleared/log/{id}```
69149

150+
### Screenshots
151+
![ALT](URL)
70152

153+
### File Tree
154+
```
155+
├── .gitignore
156+
├── CODE_OF_CONDUCT.md
157+
├── LICENSE
158+
├── README.md
159+
├── composer.json
160+
└── src
161+
├── .env.example
162+
├── LaravelLoggerServiceProvider.php
163+
├── app
164+
│   ├── Http
165+
│   │   ├── Controllers
166+
│   │   │   └── LaravelLoggerController.php
167+
│   │   ├── Middleware
168+
│   │   │   └── LogActivity.php
169+
│   │   └── Traits
170+
│   │   ├── ActivityLogger.php
171+
│   │   ├── IpAddressDetails.php
172+
│   │   └── UserAgentDetails.php
173+
│   ├── Listeners
174+
│   │   ├── LogAuthenticated.php
175+
│   │   ├── LogAuthenticationAttempt.php
176+
│   │   ├── LogFailedLogin.php
177+
│   │   ├── LogLockout.php
178+
│   │   ├── LogPasswordReset.php
179+
│   │   ├── LogSuccessfulLogin.php
180+
│   │   └── LogSuccessfulLogout.php
181+
│   ├── Logic
182+
│   │   └── helpers.php
183+
│   └── Models
184+
│   └── Activity.php
185+
├── config
186+
│   └── laravel-logger.php
187+
├── database
188+
│   └── migrations
189+
│   └── 2017_11_04_103444_create_laravel_logger_activity_table.php
190+
├── resources
191+
│   ├── lang
192+
│   │   └── en
193+
│   │   └── laravel-logger.php
194+
│   └── views
195+
│   ├── forms
196+
│   │   ├── clear-activity-log.blade.php
197+
│   │   ├── delete-activity-log.blade.php
198+
│   │   └── restore-activity-log.blade.php
199+
│   ├── logger
200+
│   │   ├── activity-log-cleared.blade.php
201+
│   │   ├── activity-log-item.blade.php
202+
│   │   ├── activity-log.blade.php
203+
│   │   └── partials
204+
│   │   └── activity-table.blade.php
205+
│   ├── modals
206+
│   │   └── confirm-modal.blade.php
207+
│   ├── partials
208+
│   │   ├── form-status.blade.php
209+
│   │   └── styles.blade.php
210+
│   └── scripts
211+
│   ├── clickable-row.blade.php
212+
│   ├── confirm-modal.blade.php
213+
│   ├── datatables.blade.php
214+
│   └── tooltip.blade.php
215+
└── routes
216+
└── web.php
217+
```
71218

219+
* Tree command can be installed using brew: `brew install tree`
220+
* File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests`
72221

73-
Laravel logger can work out the box with or without the following roles packages:
74-
* [jeremykenedy/laravel-roles](https://github.com/jeremykenedy/laravel-roles)
75-
* [spatie/laravel-permission](https://github.com/spatie/laravel-permission)
76-
* [Zizaco/entrust](https://github.com/Zizaco/entrust)
77-
* [romanbican/roles](https://github.com/romanbican/roles)
78-
* [ultraware/roles](https://github.com/ultraware/roles)
222+
### License
223+
Laravel-logger is licensed under the MIT license. Enjoy!
79224

src/app/Http/Controllers/LaravelLoggerController.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ private function mapAdditionalDetails($collectionItems)
4949
$collectionItem['langDetails'] = UserAgentDetails::localeLang($collectionItem->locale);
5050
$collectionItem['userDetails'] = config('LaravelLogger.defaultUserModel')::find($collectionItem->userId);
5151

52-
53-
54-
if (config('LaravelLogger.rolesEnabled')) {
55-
56-
57-
//dd('hey');
58-
59-
//config('LaravelLogger.roleModel')
60-
61-
}
62-
63-
64-
6552
return $collectionItem;
6653
});
6754

0 commit comments

Comments
 (0)