-
-
Notifications
You must be signed in to change notification settings - Fork 34
Fix: Add Filament v4 navigation property type declarations #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Add Filament v4 navigation property type declarations #31
Conversation
yassersebai
commented
Aug 31, 2025
- Add union types for navigationGroup and navigationIcon
- Maintains backward compatibility
- Fixes PHP Fatal Error when setting navigation properties
- Tested with Laravel 11 + Filament v4
- Add union types for navigationGroup and navigationIcon - Maintains backward compatibility - Fixes PHP Fatal Error when setting navigation properties - Tested with Laravel 11 + Filament v4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds type declarations for navigation properties to fix compatibility issues with Filament v4. The changes prevent PHP Fatal Errors when setting navigation properties by adding proper union type declarations.
- Adds union type declarations for navigationGroup and navigationIcon properties
- Maintains backward compatibility with null defaults
- Includes additional navigation property declarations for completeness
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/BoardPage.php
Outdated
|
|
||
| // Fix for Filament v4 navigation property types | ||
| protected static string|\UnitEnum|null $navigationGroup = null; | ||
| protected static string|\BackedEnum|null $navigationIcon = null; |
Copilot
AI
Aug 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type declaration uses \BackedEnum but typically Filament v4 navigation icons accept string or classes implementing specific icon interfaces. Consider verifying if \BackedEnum is the correct type for navigationIcon or if it should be a more specific interface.
| protected static string|\BackedEnum|null $navigationIcon = null; | |
| protected static string|null $navigationIcon = null; |
…ity with PHP enums - removed the leading backslashes: string|UnitEnum|null and string|BackedEnum|null - added proper imports
|
@yassersebai Hello, thank you for the PR. How can I reproduce that bug? |
Steps to Reproduce
<?php
namespace App\Filament\Pages;
use Relaticle\Flowforge\BoardPage;
use Relaticle\Flowforge\Board;
class MyKanbanPage extends BoardPage
{
protected static ?string $navigationIcon = 'heroicon-o-view-columns';
protected static ?string $navigationLabel = 'My Kanban Board';
protected static ?string $navigationGroup = "Operations";
public function board(Board $board): Board
{
return $board
->query(MyModel::query())
->recordTitleAttribute('title')
->columnIdentifier('status')
->positionIdentifier('position')
->columns([
Column::make('pending')->label('Pending'),
Column::make('active')->label('Active'),
]);
}
}
|
|
@yassersebai – For Filament V4, this is the correct way to configure navigation: protected static string|BackedEnum|null $navigationIcon = null;
protected static string|UnitEnum|null $navigationGroup = null;
protected static ?string $navigationLabel = null;No need to redeclare the same properties inside the board page. Please share your full error. |