2323use Tapp \FilamentLibrary \FilamentLibraryPlugin ;
2424use Tapp \FilamentLibrary \Models \LibraryItem ;
2525use Tapp \FilamentLibrary \Resources \RelationManagers \LibraryItemPermissionsRelationManager ;
26+ use Tapp \FilamentLibrary \Tables \Actions \BulkManagePermissionsAction ;
2627
2728class LibraryItemResource extends Resource
2829{
@@ -165,7 +166,6 @@ public static function table(Table $table): Table
165166 // - PublicLibrary (public files)
166167 // - MyLibrary (personal documents)
167168 // - CreatedByMe (user's created items)
168- // - SharedWithMe (shared items)
169169 // - SearchAll (search results)
170170 // The list pages only override getTableQuery() for filtering, not the columns
171171 return $ table
@@ -338,6 +338,7 @@ public static function table(Table $table): Table
338338 ])
339339 ->toolbarActions ([
340340 BulkActionGroup::make ([
341+ ...static ::bulkManagePermissionsActions (),
341342 DeleteBulkAction::make ()
342343 ->visible (fn (): bool => auth ()->user () && auth ()->user ()->can ('deleteAny ' , static ::getModel ()))
343344 ->successRedirectUrl (function () {
@@ -382,7 +383,7 @@ public static function getPages(): array
382383 return [
383384 'index ' => Pages \ListLibraryItems::route ('/ ' ),
384385 'my-documents ' => Pages \MyLibrary::route ('/my-documents ' ),
385- ' shared-with-me ' => Pages \SharedWithMe:: route ( ' /shared-with-me ' ),
386+ ... static :: sharedWithMePage ( ),
386387 'created-by-me ' => Pages \CreatedByMe::route ('/created-by-me ' ),
387388 'favorites ' => Pages \Favorites::route ('/favorites ' ),
388389 'public ' => Pages \PublicLibrary::route ('/public ' ),
@@ -398,6 +399,34 @@ public static function getPages(): array
398399 ];
399400 }
400401
402+ /**
403+ * @return array<string, \Filament\Resources\Pages\PageRegistration>
404+ */
405+ protected static function sharedWithMePage (): array
406+ {
407+ if (! config ('filament-library.sharing.shared_with_me ' , true )) {
408+ return [];
409+ }
410+
411+ return [
412+ 'shared-with-me ' => Pages \SharedWithMe::route ('/shared-with-me ' ),
413+ ];
414+ }
415+
416+ /**
417+ * @return array<int, BulkManagePermissionsAction>
418+ */
419+ protected static function bulkManagePermissionsActions (): array
420+ {
421+ if (! config ('filament-library.permissions.bulk_manage_action ' , false )) {
422+ return [];
423+ }
424+
425+ return [
426+ BulkManagePermissionsAction::make (),
427+ ];
428+ }
429+
401430 public static function getEditUrl ($ record ): string
402431 {
403432 return match ($ record ->type ) {
0 commit comments