diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3855a08..d9306d6 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.3' coverage: none - name: Install composer dependencies diff --git a/src/Resources/LibraryItemResource.php b/src/Resources/LibraryItemResource.php index c4032be..3c3668e 100644 --- a/src/Resources/LibraryItemResource.php +++ b/src/Resources/LibraryItemResource.php @@ -95,7 +95,8 @@ public static function form(Schema $schema): Schema \Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('files') ->label('File') ->visible(fn (callable $get) => $get('type') === 'file') - ->required(fn (callable $get) => $get('type') === 'file'), + ->required(fn (callable $get) => $get('type') === 'file') + ->maxSize(512000), // 500MB // Link form fields \Filament\Forms\Components\TextInput::make('external_url') diff --git a/src/Resources/Pages/EditFile.php b/src/Resources/Pages/EditFile.php index 531270d..1c74014 100644 --- a/src/Resources/Pages/EditFile.php +++ b/src/Resources/Pages/EditFile.php @@ -37,12 +37,33 @@ public function form(\Filament\Schemas\Schema $schema): \Filament\Schemas\Schema ->maxLength(255), \Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('files') - ->label('File'), + ->label('File') + ->maxSize(512000), // 500MB \Filament\Forms\Components\Textarea::make('link_description') ->label('Description') ->rows(3), + \Filament\Forms\Components\Select::make('tags') + ->label('Tags') + ->relationship('tags', 'name') + ->multiple() + ->searchable() + ->preload() + ->createOptionForm([ + \Filament\Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + ]) + ->createOptionUsing(function (array $data): int { + $tag = \Tapp\FilamentLibrary\Models\LibraryItemTag::create([ + 'name' => $data['name'], + 'slug' => \Illuminate\Support\Str::slug($data['name']), + ]); + + return $tag->id; + }), + \Filament\Forms\Components\Select::make('general_access') ->label('General Access') ->options(function () { diff --git a/src/Resources/Pages/EditFolder.php b/src/Resources/Pages/EditFolder.php index ce8a6cf..b5e7db3 100644 --- a/src/Resources/Pages/EditFolder.php +++ b/src/Resources/Pages/EditFolder.php @@ -28,6 +28,26 @@ public function form(\Filament\Schemas\Schema $schema): \Filament\Schemas\Schema ->label('Description') ->rows(3), + \Filament\Forms\Components\Select::make('tags') + ->label('Tags') + ->relationship('tags', 'name') + ->multiple() + ->searchable() + ->preload() + ->createOptionForm([ + \Filament\Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + ]) + ->createOptionUsing(function (array $data): int { + $tag = \Tapp\FilamentLibrary\Models\LibraryItemTag::create([ + 'name' => $data['name'], + 'slug' => \Illuminate\Support\Str::slug($data['name']), + ]); + + return $tag->id; + }), + Select::make('general_access') ->label('General Access') ->options(function () { diff --git a/src/Resources/Pages/EditLink.php b/src/Resources/Pages/EditLink.php index 65bf6fc..f72704a 100644 --- a/src/Resources/Pages/EditLink.php +++ b/src/Resources/Pages/EditLink.php @@ -32,6 +32,26 @@ public function form(\Filament\Schemas\Schema $schema): \Filament\Schemas\Schema ->label('Description') ->rows(3), + \Filament\Forms\Components\Select::make('tags') + ->label('Tags') + ->relationship('tags', 'name') + ->multiple() + ->searchable() + ->preload() + ->createOptionForm([ + \Filament\Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + ]) + ->createOptionUsing(function (array $data): int { + $tag = \Tapp\FilamentLibrary\Models\LibraryItemTag::create([ + 'name' => $data['name'], + 'slug' => \Illuminate\Support\Str::slug($data['name']), + ]); + + return $tag->id; + }), + \Filament\Forms\Components\Select::make('general_access') ->label('General Access') ->options(function () { diff --git a/src/Resources/Pages/ListLibraryItems.php b/src/Resources/Pages/ListLibraryItems.php index 53dc70b..557f0a4 100644 --- a/src/Resources/Pages/ListLibraryItems.php +++ b/src/Resources/Pages/ListLibraryItems.php @@ -123,7 +123,7 @@ protected function getHeaderActions(): array FileUpload::make('file') ->label('Upload File') ->required() - ->maxSize(10240) // 10MB + ->maxSize(512000) // 500MB ->disk('public') ->directory('library-files') ->visibility('private') diff --git a/src/Resources/Pages/MyLibrary.php b/src/Resources/Pages/MyLibrary.php index 7e126d6..86f8009 100644 --- a/src/Resources/Pages/MyLibrary.php +++ b/src/Resources/Pages/MyLibrary.php @@ -89,7 +89,7 @@ protected function getHeaderActions(): array \Filament\Forms\Components\FileUpload::make('file') ->label('Upload File') ->required() - ->maxSize(10240) // 10MB + ->maxSize(512000) // 500MB ->disk('public') ->directory('library-files') ->visibility('private')