Skip to content

Commit

Permalink
feature: initial support for Filament v3 (#83)
Browse files Browse the repository at this point in the history
Co-authored-by: ryangjchandler <ryangjchandler@users.noreply.github.com>
  • Loading branch information
ryangjchandler and ryangjchandler authored Aug 4, 2023
1 parent 9f757ee commit 74b7c80
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 6,453 deletions.
60 changes: 60 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Upgrade Guide

## Upgrading from v0.x to v1.0

Starting with version v1.0, this package now only supports Filament v3.x.

Follow these steps to update the package for Filament v3.x.

1. Update the package version in your `composer.json`.
2. Run `composer update`.
3. Register the plugin inside of your project's `PanelProvider`.

```php
use RyanChandler\FilamentNavigation\FilamentNavigation;

public function panel(Panel $panel): Panel
{
return $panel
->plugin(FilamentNavigation::make())
// ...
}
```

4. Publish the plugin assets.

```sh
php artisan filament:assets
```

5. Open your panel and check that the resource has been registered and existing navigation menus are showing.

If you have registered custom navigation item types, the `addItemType()` method no longer exists.

Instead, register the item types on the `FilamentNavigation` plugin object directly.

```php
return $panel
->plugin(
FilamentNavigation::make()
->itemType('post', [
Select::make('post_id')
->//...
])
)
// ...
```

If you previously used the configuration file to change the `navigation_model` or `navigation_resource` values, those no longer exist and need to be updated to method calls on the plugin object.

```php
return $panel
->plugin(
FilamentNavigation::make()
->usingResource(MyNavigationResource::class)
->usingModel(MyNavigationModel::class)
)
// ...
```

If you have any issues with the upgrade, please open an issue and provide details. Reproduction repositories are much appreciated.
19 changes: 8 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
"require": {
"php": "^8.1",
"doctrine/dbal": "^3.5.1",
"illuminate/contracts": "^9.0|^10.0",
"filament/filament": "^2.17",
"illuminate/contracts": "^10.0",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8",
"nunomaduro/collision": "^6.0|^7.0",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/canvas": "^7.1|^8.0",
"orchestra/testbench": "^7.0|^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"orchestra/canvas": "^8.0",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand Down Expand Up @@ -64,10 +64,7 @@
"laravel": {
"providers": [
"RyanChandler\\FilamentNavigation\\FilamentNavigationServiceProvider"
],
"aliases": {
"FilamentNavigation": "RyanChandler\\FilamentNavigation\\Facades\\FilamentNavigation"
}
]
}
},
"minimum-stability": "dev",
Expand Down
58 changes: 21 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="RyanChandler Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="RyanChandler Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit 74b7c80

Please # to comment.