File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ public function table(Table $table): Table
2828 ->striped ()
2929 ->emptyStateIcon (FilamentIcon::resolve ('inspirecms::info ' ))
3030 ->emptyStateHeading (__ ('inspirecms::widgets.page_activity.empty_state.heading ' ))
31+ ->modifyQueryUsing (fn ($ query ) => $ query ->with ([
32+ 'publishedVersions ' ,
33+ ]))
3134 ->columns ([
3235 Tables \Columns \TextColumn::make ('title ' )
3336 ->label (__ ('inspirecms::resources/content.title.label ' ))
@@ -44,17 +47,15 @@ public function table(Table $table): Table
4447 Tables \Columns \TextColumn::make ('published_at ' )
4548 ->label (__ ('inspirecms::resources/content.published_at.label ' ))
4649 ->getStateUsing (function (Model $ record ) {
47-
48- if ($ record ->hasAttribute ('__latest_version_publish_dt ' ) && $ record ->__latest_version_publish_dt ) {
49- return $ record ->__latest_version_publish_dt ->diffForHumans ();
50- }
51-
52- return $ record ->getLatestPublishedContentVersion ()?->pivot->published_at ?->diffForHumans();
50+ return $ record ->getPublishedVersions ()?->sortByDesc('pivot.published_at ' )?->first()?->pivot->published_at ;
5351 })
52+ ->formatStateUsing (fn (?\Carbon \Carbon $ state ) => ($ state && $ state instanceof \DateTimeInterface) ? $ state ->diffForHumans (now ()) : null )
53+ ->tooltip (fn ($ state ) => ($ state && $ state instanceof \DateTimeInterface) ? $ state ->toDateTimeString () : null )
5454 ->width ('5% ' ),
5555 Tables \Columns \TextColumn::make ('updated_at ' )
5656 ->label (__ ('inspirecms::resources/content.updated_at.label ' ))
5757 ->formatStateUsing (fn (?\Carbon \Carbon $ state ) => $ state ?->diffForHumans())
58+ ->tooltip (fn ($ state ) => $ state ?->toDateTimeString())
5859 ->width ('5% ' ),
5960 ]);
6061 }
You can’t perform that action at this time.
0 commit comments