Closed Tray2 closed 1 year ago
Thanks for reporting this, @Tray2. The error makes sense, since the class name collides with the one it extends.
Since this is very low priority for us to fix at the moment, could you attempt a PR, @Tray2?
You could probably check for the model name and import the extended class as BaseCreateRecord
for example.
For now you can just import as an alias
use Filament\Resources\Pages\CreateRecord as FilamentCreateRecord;
class CreateRecord extends FilamentCreateRecord
@zepfietje yes it makes total sense. I will either find a synonym or use an alias in the import for now. Not sure how to work around it when a model has a naming clash like this in a good way though.
Low priority indeed, and good as a reference if someone else runs into a similar issue.
Not sure how to work around it when a model has a naming clash like this in a good way though.
What are you unsure about? 🙂
Maybe something like this (just an example of the idea. Would need cleanup)
$this->copyStubToApp('ResourcePage', $createResourcePagePath, [
'baseResourcePage' => $createResourcePageClass === 'CreatePage' ? 'Filament\\Resources\\Pages\\CreateRecord as BaseCreateRecord' : 'Filament\\Resources\\Pages\\CreateRecord',
'baseResourcePageClass' => $createResourcePageClass === 'CreatePage' ? 'BaseCreateRecord' : 'CreateRecord',
'namespace' => "{$namespace}\\{$resourceClass}\\Pages",
'resource' => "{$namespace}\\{$resourceClass}",
'resourceClass' => $resourceClass,
'resourcePageClass' => $createResourcePageClass,
]);
Not sure how to work around it when a model has a naming clash like this in a good way though.
What are you unsure about? 🙂
How it should be fone in a pretty, effective and standardized way. However it seems to be solved already.
Package
filament/filament
Package Version
v3.0.´-stable
Laravel Version
v10.28
Livewire Version
v3.0
PHP Version
PHP 8.2.9
Problem description
The command
php artisan
in general stopped working, it throws an ugly error message saying this.(Had to put a link to a repo to be able to submit this, the one I put does not link to any gist or repo that describes this error)
Expected behavior
See a list of available artisan commands.
Steps to reproduce
php artisan make:model Record -m
php artisan make:filament-resource Record
php artisan
Reproduction repository
https://github.com/Tray2
Relevant log output
No response