Skip to content

Commit b159dbc

Browse files
authored
Merge pull request #38 from rmsramos/develop
Develop
2 parents 43417b0 + 18599ba commit b159dbc

File tree

6 files changed

+48
-26
lines changed

6 files changed

+48
-26
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ public static function getRelations(): array
321321
To make viewing activity logs easier, you can use a custom action. In your UserResource in the table function, add the `ActivityLogTimelineAction`.
322322

323323
```php
324-
use Rmsramos\Activitylog\Actions\ActivityLogTimelineAction;
324+
use Rmsramos\Activitylog\Actions\ActivityLogTimelineTableAction;
325325

326326
public static function table(Table $table): Table
327327
{
328328
return $table
329329
->actions([
330-
ActivityLogTimelineAction::make('Activities'),
330+
ActivityLogTimelineTableAction::make('Activities'),
331331
]);
332332
}
333333
```
@@ -348,13 +348,13 @@ public static function table(Table $table): Table
348348
You can configure the icons and colors, by default the `'heroicon-m-check'` icon and the `'primary'` color are used.
349349

350350
```php
351-
use Rmsramos\Activitylog\Actions\ActivityLogTimelineAction;
351+
use Rmsramos\Activitylog\Actions\ActivityLogTimelineTableAction;
352352

353353
public static function table(Table $table): Table
354354
{
355355
return $table
356356
->actions([
357-
ActivityLogTimelineAction::make('Activities')
357+
ActivityLogTimelineTableAction::make('Activities')
358358
->timelineIcons([
359359
'created' => 'heroicon-m-check-badge',
360360
'updated' => 'heroicon-m-pencil-square',
@@ -370,13 +370,13 @@ public static function table(Table $table): Table
370370
You can limit the number of results in the query by passing a limit, by default the last 10 records are returned.
371371

372372
```php
373-
use Rmsramos\Activitylog\Actions\ActivityLogTimelineAction;
373+
use Rmsramos\Activitylog\Actions\ActivityLogTimelineTableAction;
374374

375375
public static function table(Table $table): Table
376376
{
377377
return $table
378378
->actions([
379-
ActivityLogTimelineAction::make('Activities')
379+
ActivityLogTimelineTableAction::make('Activities')
380380
->limit(30),
381381
]);
382382
}
@@ -385,13 +385,13 @@ public static function table(Table $table): Table
385385
## Full Timeline configuration
386386

387387
```php
388-
use Rmsramos\Activitylog\Actions\ActivityLogTimelineAction;
388+
use Rmsramos\Activitylog\Actions\ActivityLogTimelineTableAction;
389389

390390
public static function table(Table $table): Table
391391
{
392392
return $table
393393
->actions([
394-
ActivityLogTimelineAction::make('Activities')
394+
ActivityLogTimelineTableAction::make('Activities')
395395
->withRelations(['profile', 'address'])
396396
->timelineIcons([
397397
'created' => 'heroicon-m-check-badge',

resources/lang/ar/forms.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22

33
return [
44
'fields' => [
5-
'log_name' => [
5+
'log_name' => [
66
'label' => 'النوع',
77
],
8-
'event' => [
8+
'event' => [
99
'label' => 'الحدث',
1010
],
1111
'subject_type' => [
1212
'label' => 'الموضوع',
1313
],
14-
'causer' => [
14+
'causer' => [
1515
'label' => 'المستخدم',
1616
],
17-
'description' => [
17+
'description' => [
1818
'label' => 'الوصف',
1919
],
20-
'properties' => [
20+
'properties' => [
2121
'label' => 'الخصائص',
2222
],
23-
'created_at' => [
23+
'created_at' => [
2424
'label' => 'تاريخ التسجيل',
2525
],
26-
'old' => [
26+
'old' => [
2727
'label' => 'القديم',
2828
],
29-
'attributes' => [
29+
'attributes' => [
3030
'label' => 'الجديد',
3131
],
3232
],

resources/lang/ar/tables.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
return [
44
'columns' => [
5-
'log_name' => [
5+
'log_name' => [
66
'label' => 'النوع',
77
],
8-
'event' => [
8+
'event' => [
99
'label' => 'الحدث',
1010
],
1111
'subject_type' => [
1212
'label' => 'الموضوع',
1313
],
14-
'causer' => [
14+
'causer' => [
1515
'label' => 'المستخدم',
1616
],
17-
'properties' => [
17+
'properties' => [
1818
'label' => 'الخصائص',
1919
],
20-
'created_at' => [
20+
'created_at' => [
2121
'label' => 'تاريخ التسجيل',
2222
],
2323
],
@@ -27,7 +27,7 @@
2727
'created_from' => 'تاريخ الإنشاء من',
2828
'created_until' => 'تاريخ الإنشاء حتى',
2929
],
30-
'event' => [
30+
'event' => [
3131
'label' => 'الحدث',
3232
],
3333
],
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Rmsramos\Activitylog\Actions;
4+
5+
use Filament\Tables\Actions\Action;
6+
use Rmsramos\Activitylog\Actions\Concerns\ActionContent;
7+
8+
class ActivityLogTimelineSimpleAction extends Action
9+
{
10+
use ActionContent;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Rmsramos\Activitylog\Actions;
4+
5+
use Filament\Tables\Actions\Action;
6+
use Rmsramos\Activitylog\Actions\Concerns\ActionContent;
7+
8+
class ActivityLogTimelineTableAction extends Action
9+
{
10+
use ActionContent;
11+
}

src/Actions/ActivityLogTimelineAction.php renamed to src/Actions/Concerns/ActionContent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?php
22

3-
namespace Rmsramos\Activitylog\Actions;
3+
namespace Rmsramos\Activitylog\Actions\Concerns;
44

55
use Closure;
66
use Filament\Actions\StaticAction;
77
use Filament\Infolists\Components\TextEntry;
88
use Filament\Infolists\Infolist;
9-
use Filament\Tables\Actions\Action;
109
use Illuminate\Database\Eloquent\Builder;
1110
use Illuminate\Database\Eloquent\Model;
1211
use Illuminate\Support\Collection;
@@ -16,7 +15,7 @@
1615
use Rmsramos\Activitylog\Infolists\Components\TimeLineTitleEntry;
1716
use Spatie\Activitylog\Models\Activity;
1817

19-
class ActivityLogTimelineAction extends Action
18+
trait ActionContent
2019
{
2120
private ?array $withRelations = null;
2221

@@ -63,7 +62,7 @@ protected function setUp(): void
6362
foreach ($relations as $relation) {
6463
$model = get_class($record->{$relation}()->getRelated());
6564
$query->orWhere(function (Builder $q) use ($record, $model, $relation) {
66-
$q->where('subject_type', (new $model())->getMorphClass())
65+
$q->where('subject_type', (new $model)->getMorphClass())
6766
->whereIn('subject_id', $record->{$relation}()->pluck('id'));
6867
});
6968
}
@@ -257,4 +256,5 @@ protected function formatActivityData($activity): array
257256
'update' => $activity->updated_at,
258257
];
259258
}
259+
260260
}

0 commit comments

Comments
 (0)