Skip to content

Commit bf3d228

Browse files
authored
Merge pull request #6 from Dipesh79/Dipesh79-patch-1
ref: Update README.md
2 parents 55d7d31 + 623f0e1 commit bf3d228

1 file changed

Lines changed: 3 additions & 108 deletions

File tree

README.md

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -9,121 +9,16 @@
99
This Laravel package allows you to store user logs.
1010
This package automatically stores the logs when a model is created, updated, or deleted.
1111

12-
## Usage/Examples
12+
## Quick Start
1313

1414
### Install Using Composer
1515

1616
```bash
1717
composer require dipesh79/laravel-user-logs
1818
```
19+
## Official Documentation
1920

20-
### Publish Vendor File For Migration
21-
22-
```bash
23-
php artisan vendor:publish
24-
```
25-
26-
And publish `Dipesh79\LaravelUserLogs\LaravelLogServiceProvider`
27-
28-
### Run Migration
29-
30-
```bash
31-
php artisan migrate
32-
```
33-
34-
## Model
35-
36-
Use ```HasLog``` Trait in your model. This will create a relation between your model and the `Log` model.
37-
38-
```php
39-
<?php
40-
41-
namespace App\Models;
42-
43-
use Dipesh79\LaravelUserLogs\Traits\HasLog;
44-
45-
class User extends Authenticatable
46-
{
47-
use HasLog;
48-
```
49-
50-
### Automated Static events for logs
51-
52-
The `Created`, `Updated`, `Deleted` events are fired when a model is created, updated, or deleted, respectively.
53-
You don't have to do anything else, this package will automatically store the logs in the database.
54-
55-
56-
### Access User Logs
57-
```php
58-
$logs = \Dipesh79\LaravelUserLogs\Models\Log::get();
59-
```
60-
61-
### V 1.4 update
62-
63-
View User Logs
64-
```
65-
Route::get('/logs', [Dipesh79\LaravelUserLogs\Controllers\UserLogController::class, 'index'])->name('logs');
66-
```
67-
Don't forget to guard this route with your custom or pre-defined middleware
68-
69-
### V 1.4.1 update
70-
71-
## Config File
72-
73-
```php
74-
<?php
75-
76-
return [
77-
/**
78-
* Log Viewer Theme | Options: bootstrap.
79-
*/
80-
81-
'theme' => 'bootstrap',
82-
83-
/**
84-
* Pagination Count.
85-
*/
86-
'pagination' => 10,
87-
88-
/**
89-
* User Identifier from users table.
90-
*/
91-
'user_identifier' => 'name',
92-
93-
/**
94-
* Return page from log view page.
95-
*/
96-
'return_page' => [
97-
/**
98-
* Route Type | Options: route, url.
99-
*/
100-
'route_type' => 'url',
101-
/**
102-
* Route Name or URL.
103-
*/
104-
'url' => '/'
105-
]
106-
107-
];
108-
```
109-
110-
Chose theme for user log viewer. Currently only bootstrap theme is available.
111-
You can change the pagination count for user log viewer.
112-
You can change the user identifier from users table. By default it is `name`.
113-
You can change the return page from user log viewer. By default it is `/`. You can change it to your custom route or
114-
url.
115-
116-
### V 1.5.0 Update
117-
Now updated values will be stored in database and view them in user log viewer.
118-
119-
Get Access to Old Values And Updated Values in your model
120-
```php
121-
$user_log = \Dipesh79\LaravelUserLogs\Models\Log::find(1);
122-
$old_values = $user_log->old_data;
123-
$updated_values = $user_log->changed_values;
124-
125-
```
126-
21+
Documentation can be found on my [website](https://khanaldipesh.com.np/package/laravel-user-logs).
12722

12823
## License
12924

0 commit comments

Comments
 (0)