Skip to content

Commit 6f0e53f

Browse files
committed
Fix conflicts
2 parents 745fda9 + f0dd7a9 commit 6f0e53f

19 files changed

Lines changed: 475 additions & 65 deletions

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
- name: Dependabot metadata
1616
id: metadata
17-
uses: dependabot/fetch-metadata@v2.4.0
17+
uses: dependabot/fetch-metadata@v2.5.0
1818
with:
1919
github-token: "${{ secrets.GITHUB_TOKEN }}"
2020

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,47 @@
22

33
All notable changes to `:package_name` will be documented in this file.
44

5+
## v1.0.2 - 2025-12-12
6+
7+
### What's Changed
8+
9+
* Update navigation items and permissions check by @andreia in https://github.com/TappNetwork/Filament-Library/pull/12
10+
11+
### New Contributors
12+
13+
* @andreia made their first contribution in https://github.com/TappNetwork/Filament-Library/pull/12
14+
15+
**Full Changelog**: https://github.com/TappNetwork/Filament-Library/compare/v1.0.1...v1.0.2
16+
17+
## v1.0.1 - 2025-12-03
18+
19+
### What's Changed
20+
21+
* Fix: Add validation for duplicate tags when creating new tags by @scottgrayson in https://github.com/TappNetwork/Filament-Library/pull/11
22+
23+
**Full Changelog**: https://github.com/TappNetwork/Filament-Library/compare/v1.0.0...v1.0.1
24+
25+
## v1.0.0 - 2025-11-13
26+
27+
### What's Changed
28+
29+
* feat: Plugin Foundation & Basic Models by @scottgrayson in https://github.com/TappNetwork/Filament-Library/pull/2
30+
* Feature/migration by @scottgrayson in https://github.com/TappNetwork/Filament-Library/pull/3
31+
* Laravel 12 Support, and Dependencies by @swilla in https://github.com/TappNetwork/Filament-Library/pull/5
32+
* Increase file upload size limits from 10MB to 500MB by @scottgrayson in https://github.com/TappNetwork/Filament-Library/pull/8
33+
* Add tags field to edit resource forms (EditFile, EditLink, EditFolder) by @scottgrayson in https://github.com/TappNetwork/Filament-Library/pull/9
34+
35+
### New Contributors
36+
37+
* @scottgrayson made their first contribution in https://github.com/TappNetwork/Filament-Library/pull/2
38+
* @swilla made their first contribution in https://github.com/TappNetwork/Filament-Library/pull/5
39+
40+
**Full Changelog**: https://github.com/TappNetwork/Filament-Library/commits/v1.0.0
41+
542
## 1.0.0 - 2025-01-16
643

744
### Added
45+
846
- Initial release of Filament Library plugin
947
- File and folder management with Google Drive-style permissions
1048
- External link support

phpstan-baseline.neon

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
parameters:
2+
ignoreErrors:
3+
# Database seeders - App\Models\User is application-specific
4+
-
5+
message: "#^Call to static method first\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
6+
count: 1
7+
path: database/seeders/LibrarySeeder.php
8+
9+
-
10+
message: "#^Call to static method where\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
11+
count: 1
12+
path: database/seeders/LibrarySeeder.php
13+
14+
# Config file - env() is allowed in config files
15+
-
16+
message: "#^Called 'env' outside of the config directory which returns null when the config is cached, use 'config'\\.$#"
17+
path: config/filament-library.php
18+
19+
# Forms - User model is dynamic
20+
-
21+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$name\\.$#"
22+
count: 1
23+
path: src/Forms/Components/UserSearchSelect.php
24+
25+
# Models - Properties are defined via @property annotations but PHPStan needs explicit ignores for some cases
26+
# These are false positives since properties are documented
27+
-
28+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#"
29+
path: src/Models/LibraryItem.php
30+
31+
-
32+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$user\\.$#"
33+
path: src/Models/LibraryItem.php
34+
35+
-
36+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$personal_folder_id\\.$#"
37+
path: src/Models/LibraryItem.php
38+
39+
# Policies - Properties are documented
40+
-
41+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$created_by\\.$#"
42+
count: 7
43+
path: src/Policies/LibraryItemPolicy.php
44+
45+
# Resources - Properties are documented
46+
-
47+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$deleted_at\\.$#"
48+
count: 2
49+
path: src/Resources/LibraryItemResource.php
50+
51+
-
52+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$external_url\\.$#"
53+
count: 1
54+
path: src/Resources/LibraryItemResource.php
55+
56+
-
57+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$parent_id\\.$#"
58+
count: 2
59+
path: src/Resources/LibraryItemResource.php
60+
61+
-
62+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$type\\.$#"
63+
count: 6
64+
path: src/Resources/LibraryItemResource.php
65+
66+
# Pages - Model type hints are generic but we know they're LibraryItem instances
67+
-
68+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$parent_id\\.$#"
69+
path: src/Resources/Pages
70+
71+
-
72+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#"
73+
path: src/Resources/Pages
74+
75+
-
76+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$name\\.$#"
77+
path: src/Resources/Pages
78+
79+
-
80+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$parent\\.$#"
81+
path: src/Resources/Pages
82+
83+
-
84+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$type\\.$#"
85+
path: src/Resources/Pages
86+
87+
-
88+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$created_by\\.$#"
89+
path: src/Resources/Pages
90+
91+
-
92+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$external_url\\.$#"
93+
path: src/Resources/Pages
94+
95+
-
96+
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$link_description\\.$#"
97+
path: src/Resources/Pages
98+
99+
-
100+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getFirstMedia\\(\\)\\.$#"
101+
path: src/Resources/Pages
102+
103+
-
104+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getInheritedGeneralAccessDisplay\\(\\)\\.$#"
105+
path: src/Resources/Pages
106+
107+
-
108+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:hasPermission\\(\\)\\.$#"
109+
path: src/Resources/Pages
110+
111+
-
112+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getSecureUrl\\(\\)\\.$#"
113+
path: src/Resources/Pages
114+
115+
-
116+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:isVideoUrl\\(\\)\\.$#"
117+
path: src/Resources/Pages
118+
119+
-
120+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Resources\\\\Pages\\\\EditLibraryItemPage\\:\\:\\$parentId\\.$#"
121+
count: 2
122+
path: src/Resources/Pages/EditLibraryItemPage.php
123+
124+
-
125+
message: "#^Call to static method find\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
126+
count: 1
127+
path: src/Resources/Pages/EditLibraryItemPage.php
128+
129+
-
130+
message: "#^Call to static method query\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
131+
count: 1
132+
path: src/Resources/Pages/EditLibraryItemPage.php
133+
134+
-
135+
message: "#^Left side of && is always true\\.$#"
136+
count: 1
137+
path: src/Resources/Pages/EditFile.php
138+
139+
# Relation Managers - Model type hints are generic
140+
-
141+
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:hasPermission\\(\\)\\.$#"
142+
count: 7
143+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
144+
145+
-
146+
message: "#^Call to an undefined method Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:hasRole\\(\\)\\.$#"
147+
count: 1
148+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
149+
150+
-
151+
message: "#^Call to static method find\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
152+
count: 1
153+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
154+
155+
-
156+
message: "#^Call to static method where\\(\\) on an unknown class App\\\\Models\\\\User\\.$#"
157+
count: 1
158+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
159+
160+
-
161+
message: "#^Left side of && is always true\\.$#"
162+
count: 1
163+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
164+
165+
-
166+
message: "#^Static call to instance method Filament\\\\Resources\\\\RelationManagers\\\\RelationManager\\:\\:getOwnerRecord\\(\\)\\.$#"
167+
count: 1
168+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
169+
170+
-
171+
message: "#^Anonymous function never returns null so it can be removed from the return type\\.$#"
172+
count: 1
173+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
174+
175+
# Services - Properties are documented
176+
-
177+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$parent_id\\.$#"
178+
count: 1
179+
path: src/Services/PermissionService.php
180+
181+
-
182+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$type\\.$#"
183+
count: 1
184+
path: src/Services/PermissionService.php
185+
186+
# Tables - Properties are documented
187+
-
188+
message: "#^Access to an undefined property Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem\\:\\:\\$created_by\\.$#"
189+
count: 1
190+
path: src/Tables/Columns/PermissionsColumn.php
191+
192+
# Instanceof checks - These are necessary for type narrowing but PHPStan sees them as always true
193+
# This happens because PHPStan doesn't understand the dynamic nature of the ownerRecord
194+
-
195+
message: "#^Instanceof between Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem and Tapp\\\\FilamentLibrary\\\\Models\\\\LibraryItem will always evaluate to true\\.$#"
196+
path: src/Resources/RelationManagers/LibraryItemPermissionsRelationManager.php
197+
198+
# Unused traits - These are provided for users to use in their own models
199+
-
200+
message: "#^Trait Tapp\\\\FilamentLibrary\\\\Traits\\\\HasLibraryFavorites is used zero times and is not analysed\\.$#"
201+
202+
-
203+
message: "#^Trait Tapp\\\\FilamentLibrary\\\\Traits\\\\LibraryUser is used zero times and is not analysed\\.$#"

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ parameters:
2626
- '#Call to static method make\(\) on an unknown class Filament\\Infolists\\Components\\Section#'
2727
- '#Call to deprecated method height\(\) of class Filament\\Infolists\\Components\\ImageEntry#'
2828
- '#Call to deprecated method width\(\) of class Filament\\Infolists\\Components\\ImageEntry#'
29-

src/FilamentLibraryPlugin.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Filament\Contracts\Plugin;
66
use Filament\Navigation\NavigationItem;
77
use Filament\Panel;
8+
use Tapp\FilamentLibrary\Resources\LibraryItemResource;
89

910
class FilamentLibraryPlugin implements Plugin
1011
{
@@ -58,47 +59,49 @@ public static function isLibraryAdmin($user): bool
5859

5960
public function register(Panel $panel): void
6061
{
62+
$panelId = $panel->getId();
63+
6164
$panel
6265
->resources([
63-
\Tapp\FilamentLibrary\Resources\LibraryItemResource::class,
66+
LibraryItemResource::class,
6467
])
6568
->navigationItems([
6669
NavigationItem::make('Library')
67-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('index'))
70+
->url(fn () => LibraryItemResource::getUrl('index'))
6871
->icon('heroicon-o-building-library')
6972
->group('Resource Library')
7073
->sort(1)
71-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.index')),
74+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.index")),
7275
NavigationItem::make('Search All')
73-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('search-all'))
76+
->url(fn () => LibraryItemResource::getUrl('search-all'))
7477
->icon('heroicon-o-magnifying-glass')
7578
->group('Resource Library')
7679
->sort(2)
77-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.search-all')),
80+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.search-all")),
7881
NavigationItem::make('My Documents')
79-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('my-documents'))
82+
->url(fn () => LibraryItemResource::getUrl('my-documents'))
8083
->icon('heroicon-o-folder')
8184
->group('Resource Library')
8285
->sort(3)
83-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.my-documents')),
86+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.my-documents")),
8487
NavigationItem::make('Shared with Me')
85-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('shared-with-me'))
88+
->url(fn () => LibraryItemResource::getUrl('shared-with-me'))
8689
->icon('heroicon-o-share')
8790
->group('Resource Library')
8891
->sort(4)
89-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.shared-with-me')),
92+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.shared-with-me")),
9093
NavigationItem::make('Created by Me')
91-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('created-by-me'))
94+
->url(fn () => LibraryItemResource::getUrl('created-by-me'))
9295
->icon('heroicon-o-user')
9396
->group('Resource Library')
9497
->sort(5)
95-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.created-by-me')),
98+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.created-by-me")),
9699
NavigationItem::make('Favorites')
97-
->url(fn () => \Tapp\FilamentLibrary\Resources\LibraryItemResource::getUrl('favorites'))
100+
->url(fn () => LibraryItemResource::getUrl('favorites'))
98101
->icon('heroicon-o-star')
99102
->group('Resource Library')
100103
->sort(6)
101-
->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.library.favorites')),
104+
->isActiveWhen(fn () => request()->routeIs("filament.{$panelId}.resources.library.favorites")),
102105
]);
103106
}
104107

src/FilamentLibraryServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function getAssetPackageName(): ?string
106106
}
107107

108108
/**
109-
* @return array<Asset>
109+
* @return array<Css|Js>
110110
*/
111111
protected function getAssets(): array
112112
{

src/Middleware/RedirectToCorrectEditPage.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tapp\FilamentLibrary\Middleware;
44

55
use Closure;
6+
use Filament\Facades\Filament;
67
use Illuminate\Http\Request;
78
use Tapp\FilamentLibrary\Models\LibraryItem;
89

@@ -13,20 +14,29 @@ class RedirectToCorrectEditPage
1314
*/
1415
public function handle(Request $request, Closure $next)
1516
{
16-
// Check if this is an edit route for library items
17-
if ($request->routeIs('filament.admin.resources.library.edit')) {
17+
$panel = Filament::getCurrentPanel();
18+
19+
if (! $panel) {
20+
return $next($request);
21+
}
22+
23+
$panelId = $panel->getId();
24+
25+
// Check if this is an edit route for library items in any panel
26+
if ($request->routeIs("filament.{$panelId}.resources.library.edit")) {
1827
$recordId = $request->route('record');
1928

2029
if ($recordId) {
2130
$libraryItem = LibraryItem::find($recordId);
2231

2332
if ($libraryItem) {
2433
// Redirect to the correct edit page based on type
25-
$editUrl = match ($libraryItem->type) {
26-
'folder' => route('filament.admin.resources.library.edit-folder', ['record' => $recordId]),
27-
'file' => route('filament.admin.resources.library.edit-file', ['record' => $recordId]),
28-
'link' => route('filament.admin.resources.library.edit-link', ['record' => $recordId]),
29-
default => route('filament.admin.resources.library.edit-folder', ['record' => $recordId]),
34+
$type = $libraryItem->type ?? 'folder';
35+
$editUrl = match ($type) {
36+
'folder' => route("filament.{$panelId}.resources.library.edit-folder", ['record' => $recordId]),
37+
'file' => route("filament.{$panelId}.resources.library.edit-file", ['record' => $recordId]),
38+
'link' => route("filament.{$panelId}.resources.library.edit-link", ['record' => $recordId]),
39+
default => route("filament.{$panelId}.resources.library.edit-folder", ['record' => $recordId]),
3040
};
3141

3242
return redirect($editUrl);

0 commit comments

Comments
 (0)