33namespace Backstage \Filament \Users \Resources \UserResource \Pages ;
44
55use BackedEnum ;
6+ use Backstage \Filament \Users \Actions \GenerateSignedRegistrationUri ;
7+ use Backstage \Filament \Users \Models \User ;
8+ use Backstage \Filament \Users \Resources \UserResource \UserResource ;
9+ use Backstage \Laravel \Users \Eloquent \Models \UserTraffic ;
610use Filament \Actions ;
7- use Filament \Tables \Table ;
811use Filament \Actions \Action ;
12+ use Filament \Auth \Notifications \ResetPassword ;
13+ use Filament \Auth \Notifications \VerifyEmail ;
914use Filament \Facades \Filament ;
10- use Illuminate \Support \HtmlString ;
11- use Filament \Support \Icons \Heroicon ;
15+ use Filament \Infolists \Components \KeyValueEntry ;
16+ use Filament \Infolists \Components \TextEntry ;
17+ use Filament \Resources \Pages \ViewRecord ;
1218use Filament \Schemas \Components \Grid ;
13- use Illuminate \Support \Facades \Blade ;
19+ use Filament \Schemas \Components \Section ;
20+ use Filament \Support \Icons \Heroicon ;
1421use Filament \Tables \Columns \TextColumn ;
22+ use Filament \Tables \Concerns \InteractsWithTable ;
1523use Filament \Tables \Contracts \HasTable ;
16- use Illuminate \Database \Eloquent \Model ;
17- use Filament \Resources \Pages \ViewRecord ;
18- use Filament \Schemas \Components \Section ;
19- use Backstage \Filament \Users \Models \User ;
20- use Filament \Schemas \Components \Fieldset ;
21- use Illuminate \Database \Eloquent \Builder ;
24+ use Filament \Tables \Table ;
2225use Illuminate \Contracts \Support \Htmlable ;
23- use Filament \Auth \Notifications \VerifyEmail ;
24- use Filament \Infolists \Components \TextEntry ;
25- use Filament \Auth \Notifications \ResetPassword ;
26- use Filament \Infolists \Components \KeyValueEntry ;
27- use Filament \Tables \Concerns \InteractsWithTable ;
28- use Backstage \Laravel \Users \Eloquent \Models \UserTraffic ;
29- use Backstage \Filament \Users \Resources \UserResource \UserResource ;
30- use Backstage \Filament \Users \Actions \GenerateSignedRegistrationUri ;
26+ use Illuminate \Database \Eloquent \Builder ;
27+ use Illuminate \Database \Eloquent \Model ;
28+ use Illuminate \Support \Facades \Blade ;
29+ use Illuminate \Support \HtmlString ;
3130
3231class ViewUser extends ViewRecord implements HasTable
3332{
@@ -48,13 +47,13 @@ protected function getHeaderActions(): array
4847
4948 return redirect ()->away ($ url );
5049 })
51- ->visible (fn (User $ record ): bool => $ record ->userIsRegistered () === false )
50+ ->visible (fn (User $ record ): bool => $ record ->userIsRegistered () === false )
5251 ->requiresConfirmation ()
5352 ->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. ' )),
5453
5554 Actions \ActionGroup::make ([
5655 Actions \Action::make ('send_verify_user_email ' )
57- ->visible (fn (User $ record ): bool => $ record ->hasVerifiedEmail () === false )
56+ ->visible (fn (User $ record ): bool => $ record ->hasVerifiedEmail () === false )
5857 ->label (__ ('Send Verification Email ' ))
5958 ->action (function ($ record ) {
6059 $ notification = new VerifyEmail ;
@@ -125,8 +124,8 @@ public function getSubheading(): string | Htmlable | null
125124 public function table (Table $ table ): Table
126125 {
127126 return $ table
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) ' , [
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) ' , [
130129 'count ' => $ table ->getQuery ()->count (),
131130 ]))))
132131 ->searchable ()
@@ -138,8 +137,8 @@ public function table(Table $table): Table
138137 ->headerActions ([
139138 Action::make ('reset ' )
140139 ->label (__ ('Reset position ' ))
141- ->icon (fn (): BackedEnum => Heroicon::ArrowUturnLeft)
142- ->url (fn (): string => $ this ->getUrl ([
140+ ->icon (fn (): BackedEnum => Heroicon::ArrowUturnLeft)
141+ ->url (fn (): string => $ this ->getUrl ([
143142 'record ' => $ this ->record ,
144143 ]))
145144 ->visible (function () {
@@ -162,23 +161,23 @@ public function table(Table $table): Table
162161 Action::make ('visit ' )
163162 ->button ()
164163 ->hiddenLabel ()
165- ->color (fn (): string => 'primary ' )
166- ->tooltip (fn (): string => __ ('Visit Path ' ))
167- ->icon (fn (): BackedEnum => Heroicon::ArrowTopRightOnSquare)
168- ->url (fn (UserTraffic $ record ): string => $ record ->getAttribute ('full_url ' ), true ),
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 ),
169168
170169 Action::make ('view ' )
171170 ->button ()
172171 ->hiddenLabel ()
173- ->color (fn (): string => 'gray ' )
174- ->tooltip (fn (): string => __ ('View Traffic ' ))
175- ->icon (fn (): BackedEnum => Heroicon::Eye)
172+ ->color (fn (): string => 'gray ' )
173+ ->tooltip (fn (): string => __ ('View Traffic ' ))
174+ ->icon (fn (): BackedEnum => Heroicon::Eye)
176175 ->slideOver ()
177176 ->modal ()
178- ->modalIcon (fn (): BackedEnum => Heroicon::Eye)
179- ->modalHeading (fn (): string => __ ('Traffic Details ' ))
180- ->modalDescription (fn (UserTraffic $ record ): Htmlable => new HtmlString (__ ('Traffic details for :path ' , [
181- 'path ' => '<a href=" ' . e ($ record ->getAttribute ('full_url ' )) . '" target="_blank" class="text-primary-600 underline"> ' . e ($ record ->getAttribute ('path ' )) . '</a> '
177+ ->modalIcon (fn (): BackedEnum => Heroicon::Eye)
178+ ->modalHeading (fn (): string => __ ('Traffic Details ' ))
179+ ->modalDescription (fn (UserTraffic $ record ): Htmlable => new HtmlString (__ ('Traffic details for :path ' , [
180+ 'path ' => '<a href=" ' . e ($ record ->getAttribute ('full_url ' )) . '" target="_blank" class="text-primary-600 underline"> ' . e ($ record ->getAttribute ('path ' )) . '</a> ' ,
182181 ])))
183182 ->schema ([
184183 Section::make (__ ('Request Information ' ))
@@ -190,7 +189,7 @@ public function table(Table $table): Table
190189 TextEntry::make ('method ' )
191190 ->label (__ ('Method ' ))
192191 ->badge ()
193- ->color (fn (string $ state ): string => match ($ state ) {
192+ ->color (fn (string $ state ): string => match ($ state ) {
194193 'GET ' => 'success ' ,
195194 'POST ' => 'primary ' ,
196195 'PUT ' => 'warning ' ,
@@ -205,7 +204,7 @@ public function table(Table $table): Table
205204
206205 TextEntry::make ('user_agent ' )
207206 ->label (__ ('User Agent ' ))
208- ->copyable ()
207+ ->copyable (),
209208 ])
210209 ->columnSpanFull (),
211210
@@ -217,9 +216,9 @@ public function table(Table $table): Table
217216
218217 TextEntry::make ('referer ' )
219218 ->label (__ ('Source Referer ' ))
220- ->copyable ()
219+ ->copyable (),
221220 ])
222- ->columnSpanFull ()
221+ ->columnSpanFull (),
223222 ])
224223 ->columns (1 ),
225224
@@ -237,7 +236,7 @@ public function table(Table $table): Table
237236
238237 KeyValueEntry::make ('route_parameters ' )
239238 ->label (__ ('Route Parameters ' ))
240- ->columnSpanFull ()
239+ ->columnSpanFull (),
241240 ])
242241 ->columns (2 ),
243242
0 commit comments