Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andreia committed Aug 16, 2023
0 parents commit 1504b24
Show file tree
Hide file tree
Showing 16 changed files with 608 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PHP Linting (Pint)
on:
workflow_dispatch:
push:
branches-ignore:
- 'dependabot/npm_and_yarn/*'
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "laravel-pint"
uses: aglipanci/laravel-pint-action@0.1.0
with:
preset: laravel

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: PHP Linting (Pint)
skip_fetch: true
28 changes: 28 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Update Changelog'

on:
release:
types: [released]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.release.target_commitish }}
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/node_modules
/vendor
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.idea
/.vscode
/build
/coverage
.DS_Store
composer.phar
phpunit.xml
phpstan.neon
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to the "Filament Authentication Log" will be documented in this file.
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Filament Authentication Log

A Filament plugin for [Laravel Authentication Log](https://github.com/rappasoft/laravel-authentication-log) package.

This package provides a Filament resource and a relation manager for [Laravel Authentication Log](https://github.com/rappasoft/laravel-authentication-log).

## Requirements
- PHP 8.1
- [Filament 3](https://github.com/laravel-filament/filament)

## Dependencies
- [rappasoft/laravel-authentication-log](https://github.com/rappasoft/laravel-authentication-log)

## Installation

You can install the plugin via Composer:

```bash
composer require tapp/filament-authentication-log:"^3.0"
```

> **Note**
> For **Filament 2.x** check the **[2.x](https://github.com//TappNetwork/filament-authentication-log/tree/2.x)** branch
You can publish the translations files with:

```bash
php artisan vendor:publish --tag="filament-authentication-log-translations"
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="filament-authentication-log-config"
```

## Using the Resource

Add this plugin to a panel on `plugins()` method.
E.g. in `app/Providers/Filament/AdminPanelProvider.php`:

```php
use Tapp\FilamentAuthenticationLog\FilamentAuthenticationLogPlugin;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentAuthenticationLogPlugin::make(),
//...
]);
}
```

That's it! Now you can see the Authentication Log resource on left sidebar.

### Resource appareance

![Filament Authentication Log Resource](https://raw.githubusercontent.com/TappNetwork/filament-authentication-log/main/docs/resource01.png)

![Filament Authentication Log Resource with filters and tooltip](https://raw.githubusercontent.com/TappNetwork/filament-authentication-log/main/docs/resource02.png)


## Using the Relation Manager

Add the `Tapp\FilamentAuthenticationLog\RelationManagers\` to the `getRelations()` method on the Filament resource where the model uses the `AuthenticationLoggable` trait.

E.g. in `App\Filament\Resources\UserResource.php`:

```php
use Tapp\FilamentAuthenticationLog\RelationManagers\AuthenticationLogsRelationManager;

public static function getRelations(): array
{
return [
AuthenticationLogsRelationManager::class,
// ...
];
}
```

### Relation manager appareance

![Filament Authentication Log Relation Manager](https://raw.githubusercontent.com/TappNetwork/filament-authentication-log/main/docs/relation_manager.png)
62 changes: 62 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "tapp/filament-authentication-log",
"description": "Filament authentication log plugin.",
"keywords": [
"tapp network",
"filament",
"authentication",
"log",
"resource",
"relation manager"
],
"license": "MIT",
"authors": [
{
"name": "Tapp Network",
"email": "steve@tappnetwork.com",
"role": "Developer"
},
{
"name": "Tapp Network",
"email": "andreia.bohner@tappnetwork.com",
"role": "Developer"
}
],
"homepage": "https://github.com/TappNetwork/filament-authentication-log",
"support": {
"issues": "https://github.com/TappNetwork/filament-authentication-log/issues",
"source": "https://github.com/TappNetwork/filament-authentication-log"
},
"require": {
"php": "^8.1",
"filament/filament": "^3.0-stable",
"rappasoft/laravel-authentication-log": "^3.0",
"spatie/laravel-package-tools": "^1.9"
},
"require-dev": {
"laravel/pint": "^1.11"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/TappNetwork/filament-authentication-log"
}
],
"autoload": {
"psr-4": {
"Tapp\\FilamentAuthenticationLog\\": "src"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Tapp\\FilamentAuthenticationLog\\FilamentAuthenticationLogServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
25 changes: 25 additions & 0 deletions config/filament-authentication-log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

return [

'resources' => [
'AutenticationLogResource' => \Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogResource::class,
],

'authenticable-resources' => [
\App\Models\User::class,
],

'navigation' => [
'authentication-log' => [
'sort' => 1,
'icon' => 'heroicon-o-shield-check',
],
],

'sort' => [
'column' => 'login_at',
'direction' => 'desc',
],

];
Binary file added docs/relation_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/resource01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/resource02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions resources/lang/en/filament-authentication-log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

return [
'navigation.group' => 'Logins',

'navigation.authentication-log.label' => 'Authentication Log',
'navigation.authentication-log.plural-label' => 'Authentication Logs',

'table.heading' => 'Authentication Logs',

'column.authenticatable' => 'Authenticatable',
'column.ip_address' => 'IP Address',
'column.user_agent' => 'User Agent',
'column.login_at' => 'Login At',
'column.login_successful' => 'Login Successful',
'column.logout_at' => 'Logout At',
'column.cleared_by_user' => 'Cleared By User',
];
32 changes: 32 additions & 0 deletions src/FilamentAuthenticationLogPlugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Tapp\FilamentAuthenticationLog;

use Filament\Contracts\Plugin;
use Filament\Panel;

class FilamentAuthenticationLogPlugin implements Plugin
{
public static function make(): static
{
return app(static::class);
}

public function getId(): string
{
return 'authentication-log';
}

public function register(Panel $panel): void
{
$panel
->resources(
config('filament-authentication-log.resources')
);
}

public function boot(Panel $panel): void
{
//
}
}
25 changes: 25 additions & 0 deletions src/FilamentAuthenticationLogServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Tapp\FilamentAuthenticationLog;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class FilamentAuthenticationLogServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament-authentication-log';

public function configurePackage(Package $package): void
{
$package->name('filament-authentication-log')
->hasConfigFile('filament-authentication-log')
->hasTranslations('filament-authentication-log');
}

public function packageBooted(): void
{
parent::packageBooted();

//
}
}
Loading

0 comments on commit 1504b24

Please sign in to comment.