@@ -85,10 +85,20 @@ public static function form(Form $form): Form
8585 ])
8686 ]),
8787 Card::make ([
88- KeyValue::make ('properties ' )
89- ->label (__ ('filament-logger::filament-logger.resource.label.properties ' )),
90- ])
91- ->visible (fn ($ record ) => $ record ->properties ?->count() > 0 )
88+ KeyValue::make ('properties ' )
89+ ->visible (fn ($ livewire ) => !isset ($ livewire ->data ['properties ' ]['attributes ' ]))
90+ ->label (__ ('filament-logger::filament-logger.resource.label.properties ' ))
91+ ->columnSpan ('full ' ),
92+
93+ KeyValue::make ('properties.old ' )
94+ ->visible (fn ($ livewire ) => isset ($ livewire ->data ['properties ' ]['old ' ]))
95+ ->label (__ ('filament-logger::filament-logger.resource.label.old ' )),
96+
97+ KeyValue::make ('properties.attributes ' )
98+ ->visible (fn ($ livewire ) => isset ($ livewire ->data ['properties ' ]['attributes ' ]))
99+ ->label (__ ('filament-logger::filament-logger.resource.label.new ' )),
100+
101+ ])->columns (2 )->visible (fn ($ record ) => $ record ->properties ?->count() > 0 )
92102 ])
93103 ->columns (['sm ' => 4 , 'lg ' => null ]);
94104 }
@@ -140,7 +150,44 @@ public static function table(Table $table): Table
140150 SelectFilter::make ('subject_type ' )
141151 ->label (__ ('filament-logger::filament-logger.resource.label.subject_type ' ))
142152 ->options (static ::getSubjectTypeList ()),
153+ Filter::make ('properties->old ' )
154+ ->label ('Old Value ' )
155+ ->indicateUsing (function (array $ data ): ?string {
156+ if (!$ data ['old ' ]) {
157+ return null ;
158+ }
159+
160+ return 'Old Attribute or Value: ' . $ data ['old ' ];
161+ })
162+ ->form ([
163+ TextInput::make ('old ' )->hint ('Can be key or value ' ),
164+ ])
165+ ->query (function (Builder $ query , array $ data ): Builder {
166+ if (!$ data ['old ' ]) {
167+ return $ query ;
168+ }
169+
170+ return $ query ->where ('properties->old ' , 'like ' , "% {$ data ['old ' ]}% " );
171+ }),
172+ Filter::make ('properties->attributes ' )
173+ ->label ('New Value ' )
174+ ->indicateUsing (function (array $ data ): ?string {
175+ if (!$ data ['new ' ]) {
176+ return null ;
177+ }
178+
179+ return 'New Attribute or Value: ' . $ data ['new ' ];
180+ })
181+ ->form ([
182+ TextInput::make ('new ' )->hint ('Can be key or value ' ),
183+ ])
184+ ->query (function (Builder $ query , array $ data ): Builder {
185+ if (!$ data ['new ' ]) {
186+ return $ query ;
187+ }
143188
189+ return $ query ->where ('properties->attributes ' , 'like ' , "% {$ data ['new ' ]}% " );
190+ }),
144191 Filter::make ('created_at ' )
145192 ->form ([
146193 DatePicker::make ('logged_at ' )
0 commit comments