Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Z3d0X/filament-logger into …
Browse files Browse the repository at this point in the history
…patch-1
  • Loading branch information
Z3d0X committed Sep 27, 2022
2 parents 7d5c8d0 + e609c91 commit a788e34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ This is the contents of the published config file:
```php
<?php
return [
'datetime_format' => 'd/m/Y H:i:s',
'date_format' => 'd/m/Y',

'activity_resource' => \Z3d0X\FilamentLogger\Resources\ActivityResource::class,

'resources' => [
Expand Down Expand Up @@ -78,7 +81,7 @@ return [
// 'log_name' => 'Custom',
// 'color' => 'primary',
// ]
]
],
];
```
## Future Scope
Expand Down
3 changes: 3 additions & 0 deletions config/filament-logger.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
return [
'datetime_format' => 'd/m/Y H:i:s',
'date_format' => 'd/m/Y',

'activity_resource' => \Z3d0X\FilamentLogger\Resources\ActivityResource::class,

'resources' => [
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/ActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function form(Form $form): Form
->label(__('filament-logger::filament-logger.resource.label.event'))
->content(function (?Model $record): string {
/** @var Activity $record */
return $record->created_at ? "{$record->created_at->format('d/m/Y H:i')}" : '-';
return $record->created_at ? "{$record->created_at->format(config('filament-logger.datetime_format', 'd/m/Y H:i:s'))}" : '-';
}),
])
]),
Expand Down Expand Up @@ -138,7 +138,7 @@ public static function table(Table $table): Table

TextColumn::make('created_at')
->label(__('filament-logger::filament-logger.resource.label.logged_at'))
->dateTime('d/m/Y H:i:s')
->dateTime(config('filament-logger.datetime_format', 'd/m/Y H:i:s'))
->sortable(),
])
->defaultSort('created_at', 'desc')
Expand Down Expand Up @@ -192,7 +192,7 @@ public static function table(Table $table): Table
->form([
DatePicker::make('logged_at')
->label(__('filament-logger::filament-logger.resource.label.logged_at'))
->displayFormat('d/m/Y'),
->displayFormat(config('filament-logger.date_format', 'd/m/Y')),
])
->query(function (Builder $query, array $data): Builder {
return $query
Expand Down

0 comments on commit a788e34

Please sign in to comment.