Skip to content

Commit

Permalink
Merge pull request #5 from rappasoft/develop
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
rappasoft authored Oct 11, 2021
2 parents 015d2f9 + e26d2d8 commit f252d05
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to `Laravel Authentication Log` will be documented in this file.

### 1.1.0 - 2021-10-11

### Added

- Known issues section to readme
- Ability to set DB connection type - https://github.com/rappasoft/laravel-authentication-log/pull/4

## 1.0.0 - 2021-09-30

- Initial Release
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ return [
// You can change this if the database keys get too long for your driver
'table_name' => 'authentication_log',

// The database connection where the authentication_log table resides. Leave empty to use the default
'db_connection' => null,

'notifications' => [
'new-device' => [
// Send the NewDevice notification
Expand Down Expand Up @@ -227,7 +230,7 @@ class AuthenticationLog extends DataTableComponent
->orWhere('location->state_name', 'like', '%'.$searchTerm.'%')
->orWhere('location->postal_code', 'like', '%'.$searchTerm.'%');
})
->format(fn($value) => $value['default'] === false ? $value['city'] . ', ' . $value['state'] : '-'),
->format(fn ($value) => $value && $value['default'] === false ? $value['city'] . ', ' . $value['state'] : '-'),
Column::make('Login At')
->sortable()
->format(fn($value) => $value ? timezone()->convertToLocal($value) : '-'),
Expand Down Expand Up @@ -260,6 +263,10 @@ Example:

![Example Log Table](https://imgur.com/B4DlN4W.png)

## Known Issues

- [This cache store is not supported. - torann/geoip](https://github.com/Torann/laravel-geoip/issues/147#issuecomment-528414630)

## Testing

```bash
Expand Down
3 changes: 3 additions & 0 deletions config/authentication-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// You can change this if the database keys get too long for your driver
'table_name' => 'authentication_log',

// The database connection where the authentication_log table resides. Leave empty to use the default
'db_connection' => null,

'notifications' => [
'new-device' => [
// Send the NewDevice notification
Expand Down
9 changes: 9 additions & 0 deletions src/Models/AuthenticationLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class AuthenticationLog extends Model
'logout_at',
];

public function __construct(array $attributes = [])
{
if (! isset($this->connection)) {
$this->setConnection(config('authentication-log.db_connection'));
}

parent::__construct($attributes);
}

public function getTable()
{
return config('authentication-log.table_name', parent::getTable());
Expand Down

0 comments on commit f252d05

Please sign in to comment.