1717use Filament \Resources \Pages \ViewRecord ;
1818use Filament \Schemas \Components \Grid ;
1919use Filament \Schemas \Components \Section ;
20+ use Filament \Support \Enums \Alignment ;
2021use Filament \Support \Icons \Heroicon ;
2122use Filament \Tables \Columns \TextColumn ;
2223use Filament \Tables \Concerns \InteractsWithTable ;
@@ -47,13 +48,13 @@ protected function getHeaderActions(): array
4748
4849 return redirect ()->away ($ url );
4950 })
50- ->visible (fn (User $ record ): bool => $ record ->userIsRegistered () === false )
51+ ->visible (fn (User $ record ): bool => $ record ->userIsRegistered () === false )
5152 ->requiresConfirmation ()
5253 ->modalDescription (__ ('This action will open the registration link for this user. By confirming, you will be redirected to the registration page and logged out of your current session. ' )),
5354
5455 Actions \ActionGroup::make ([
5556 Actions \Action::make ('send_verify_user_email ' )
56- ->visible (fn (User $ record ): bool => $ record ->hasVerifiedEmail () === false )
57+ ->visible (fn (User $ record ): bool => $ record ->hasVerifiedEmail () === false )
5758 ->label (__ ('Send Verification Email ' ))
5859 ->action (function ($ record ) {
5960 $ notification = new VerifyEmail ;
@@ -124,25 +125,26 @@ public function getSubheading(): string | Htmlable | null
124125 public function table (Table $ table ): Table
125126 {
126127 return $ table
127- ->query (fn (): Builder => $ this ->record ->traffic ()->whereNot ('path ' , 'livewire/update ' )->orderByDesc ('created_at ' )->getQuery ())
128- ->heading (fn ($ table ): Htmlable => new HtmlString (Blade::render ('<filament::icon icon="heroicon-m-user"/> ' . __ ('User Traffic (:count) ' , [
128+ ->query (fn (): Builder => $ this ->record ->traffic ()->whereNot ('path ' , 'livewire/update ' )->orderByDesc ('created_at ' )->getQuery ())
129+ ->heading (fn ($ table ): Htmlable => new HtmlString (Blade::render ('<filament::icon icon="heroicon-m-user"/> ' . __ ('User Traffic (:count) ' , [
129130 'count ' => $ table ->getQuery ()->count (),
130131 ]))))
131132 ->searchable ()
132133 ->paginated ([4 ])
133134 ->columns ([
134135 TextColumn::make ('path ' )
136+ ->label (__ ('Path ' ))
135137 ->searchable (),
136138 ])
137139 ->headerActions ([
138140 Action::make ('reset ' )
139141 ->label (__ ('Reset position ' ))
140- ->icon (fn (): BackedEnum => Heroicon::ArrowUturnLeft)
141- ->url (fn (): string => $ this ->getUrl ([
142+ ->icon (fn (): BackedEnum => Heroicon::ArrowUturnLeft)
143+ ->url (fn (): string => $ this ->getUrl ([
142144 'record ' => $ this ->record ,
143145 ]))
144146 ->visible (function () {
145- $ tableRecords = $ this ->getTAbleRecords ();
147+ $ tableRecords = $ this ->getTableRecords ();
146148
147149 $ firstFourRecords = $ this ->getTable ()->getQuery ()->take (4 )->get ();
148150
@@ -161,22 +163,22 @@ public function table(Table $table): Table
161163 Action::make ('visit ' )
162164 ->button ()
163165 ->hiddenLabel ()
164- ->color (fn (): string => 'primary ' )
165- ->tooltip (fn (): string => __ ('Visit Path ' ))
166- ->icon (fn (): BackedEnum => Heroicon::ArrowTopRightOnSquare)
167- ->url (fn (UserTraffic $ record ): string => $ record ->getAttribute ('full_url ' ), true ),
166+ ->color (fn (): string => 'primary ' )
167+ ->tooltip (fn (): string => __ ('Visit Path ' ))
168+ ->icon (fn (): BackedEnum => Heroicon::ArrowTopRightOnSquare)
169+ ->url (fn (UserTraffic $ record ): string => $ record ->getAttribute ('full_url ' ), true ),
168170
169171 Action::make ('view ' )
170172 ->button ()
171173 ->hiddenLabel ()
172- ->color (fn (): string => 'gray ' )
173- ->tooltip (fn (): string => __ ('View Traffic ' ))
174- ->icon (fn (): BackedEnum => Heroicon::Eye)
174+ ->color (fn (): string => 'gray ' )
175+ ->tooltip (fn (): string => __ ('View Traffic ' ))
176+ ->icon (fn (): BackedEnum => Heroicon::Eye)
175177 ->slideOver ()
176178 ->modal ()
177- ->modalIcon (fn (): BackedEnum => Heroicon::Eye)
178- ->modalHeading (fn (): string => __ ('Traffic Details ' ))
179- ->modalDescription (fn (UserTraffic $ record ): Htmlable => new HtmlString (__ ('Traffic details for :path ' , [
179+ ->modalIcon (fn (): BackedEnum => Heroicon::Eye)
180+ ->modalHeading (fn (): string => __ ('Traffic Details ' ))
181+ ->modalDescription (fn (UserTraffic $ record ): Htmlable => new HtmlString (__ ('Traffic details for :path ' , [
180182 'path ' => '<a href=" ' . e ($ record ->getAttribute ('full_url ' )) . '" target="_blank" class="text-primary-600 underline"> ' . e ($ record ->getAttribute ('path ' )) . '</a> ' ,
181183 ])))
182184 ->schema ([
@@ -189,7 +191,7 @@ public function table(Table $table): Table
189191 TextEntry::make ('method ' )
190192 ->label (__ ('Method ' ))
191193 ->badge ()
192- ->color (fn (string $ state ): string => match ($ state ) {
194+ ->color (fn (string $ state ): string => match ($ state ) {
193195 'GET ' => 'success ' ,
194196 'POST ' => 'primary ' ,
195197 'PUT ' => 'warning ' ,
@@ -241,12 +243,8 @@ public function table(Table $table): Table
241243 ->columns (2 ),
242244
243245 ])
244- ->modalContent (),
246+ ->modalFooterActionsAlignment (Alignment::Center)
247+ ->modalSubmitAction (fn (Action $ action ) => $ action ->visible (false ))
245248 ]);
246249 }
247-
248- public function updated ($ name , $ value )
249- {
250- logger ()->info ("Property [ {$ name }] was updated to: " , ['new ' => $ value ]);
251- }
252250}
0 commit comments