updated to filament 4

This commit is contained in:
jayson-temporas
2025-07-04 17:48:18 +08:00
parent 4f903764c8
commit abb728dc31
5 changed files with 1512 additions and 836 deletions

View File

@@ -22,19 +22,24 @@ A simple bookmark management system for Laravel Filament applications. This pack
## Requirements
- PHP 8.3+
- Laravel 10+
- Filament 3.2+
- Livewire 3+
- Laravel 11+
- Filament 3 or 4
## Installation
1. **Install the package via Composer:**
**Install the package via Composer:**
### For Filament 3
```bash
composer require jaysontemporas/page-bookmarks
composer require jaysontemporas/page-bookmarks:"1.0"
```
2. **Publish and run the installation command:**
### For Filament 4
```bash
composer require jaysontemporas/page-bookmarks:"2.0"
```
**Publish and run the installation command:**
```bash
php artisan page-bookmarks:install
@@ -84,10 +89,15 @@ return [
];
```
This package utilizes Filament's theming system, so you'll need to set up a custom theme to properly style all components.
> [!NOTE] Before proceeding, ensure you have configured a custom theme if you're using Filament Panels. Check the [Filament documentation on themes](https://filamentphp.com/docs/3.x/panels/themes) for detailed instructions. This step is required for both the Panels Package and standalone Forms package.
> [!NOTE] Before proceeding, ensure you have configured a custom theme if you're using Filament Panels. Check the Filament documentation on themes for detailed instructions. This step is required for both the Panels Package and standalone Forms package.
[Filament 3](https://filamentphp.com/docs/3.x/panels/themes)
[Filament 4](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme)
### Filament 3
To properly compile all the package styles, update your Tailwind configuration by adding the package's view paths:
```js
@@ -102,6 +112,12 @@ module.exports = {
// The rest of your Tailwind config
};
```
### Filament 4
Add the plugin's views to your theme css file.
```css
@source '../../../../vendor/jaysontemporas/page-bookmarks/resources/**/*.blade.php';
```
## Usage

View File

@@ -1,10 +1,11 @@
{
"name": "jaysontemporas/page-bookmarks",
"version": "1.0.2",
"version": "2.0.0",
"type": "library",
"require-dev": {
"php": "^8.3",
"laravel/pint": "^1.17"
"laravel/pint": "^1.17",
"filament/upgrade": "^4.0"
},
"license": "MIT",
"autoload": {
@@ -24,10 +25,10 @@
"name": "Jayson Temporas"
}
],
"minimum-stability": "stable",
"minimum-stability": "beta",
"prefer-stable": true,
"require": {
"filament/filament": "^3.2",
"spatie/laravel-package-tools": "^1.18"
"filament/filament": "^4.0",
"spatie/laravel-package-tools": "^1.9"
}
}

2290
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,13 @@ declare(strict_types=1);
namespace JaysonTemporas\PageBookmarks\Livewire;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Forms\Set;
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
@@ -21,7 +21,7 @@ use Livewire\Attributes\On;
use Livewire\Component;
/**
* @property Form $form
* @property Schema $form
*/
class BookmarkManager extends Component implements HasForms
{
@@ -64,10 +64,10 @@ class BookmarkManager extends Component implements HasForms
return $folders;
}
public function form(Form $form): Form
public function form(Schema $schema): Schema
{
return $form
->schema([
return $schema
->components([
TextInput::make('name')
->required()
->maxLength(255),

View File

@@ -2,6 +2,7 @@
namespace JaysonTemporas\PageBookmarks;
use Filament\View\PanelsRenderHook;
use Filament\Support\Facades\FilamentView;
use Illuminate\Support\Facades\Blade;
use JaysonTemporas\PageBookmarks\Livewire\BookmarkManager;
@@ -38,12 +39,12 @@ class PageBookmarksServiceProvider extends PackageServiceProvider
Livewire::component('page-bookmarks::livewire.bookmark-viewer', BookmarkViewer::class);
FilamentView::registerRenderHook(
config('page-bookmarks.render_hooks.add_bookmark', \Filament\View\PanelsRenderHook::GLOBAL_SEARCH_AFTER),
config('page-bookmarks.render_hooks.add_bookmark', PanelsRenderHook::GLOBAL_SEARCH_AFTER),
fn (): string => Blade::render("@livewire('page-bookmarks::livewire.bookmark-manager')"),
);
FilamentView::registerRenderHook(
config('page-bookmarks.render_hooks.view_bookmarks', \Filament\View\PanelsRenderHook::GLOBAL_SEARCH_AFTER),
config('page-bookmarks.render_hooks.view_bookmarks', PanelsRenderHook::GLOBAL_SEARCH_AFTER),
fn (): string => Blade::render("@livewire('page-bookmarks::livewire.bookmark-viewer')"),
);
}