LiruLiruLiru
LiruLiruLiru
FFilament
Created by LiruLiruLiru on 11/9/2024 in #❓┊help
Pest Testing Issue: “Cannot declare class” Error with Multiple Tests in Same File
Subject: PestPHP Testing Issue: “Cannot declare class” Error with Multiple Tests in Same File Hello everyone, I’m encountering an issue while using the PestPHP testing framework in my project. I have two tests within the same file, and a beforeEach hook: it("Test something", function () { // ...logicTest }); it("Test something else", function () { // ...logicTest }); When I run these tests together, I receive the following error: Cannot declare class App\Filament\Pages\Auth\AppRegister, because the name is already in use This class (App\Filament\Pages\Auth\AppRegister) is one I created. Interestingly, if I comment out either of the tests, the remaining test runs without any issues. I suspect there might be a problem with class redeclaration or a lack of proper cleanup between tests. Has anyone faced a similar issue or can provide guidance on what might be going wrong? Am I missing some cleanup steps or configurations in Pest? Any insights or suggestions would be greatly appreciated. Thank you!
2 replies
FFilament
Created by LiruLiruLiru on 9/2/2024 in #❓┊help
Is it possible to use relationships inside my form when extending the Auth\Register class?
I'm trying to extend Filament\Pages\Auth\Register because i want to add more fields to my register form. I'm trying to use a Fieldset with ->relationship but I'm getting Call to a member function playerProfile() on null I've worked with Filament in the past and I've read the documentation, but I feel like either I'm missing something obvious or this is not possible out of the box? My code: /app/Filament/Pages/Auth/Register.php
Fieldset::make('player')
->relationship('playerProfile')
->schema([
Select::make('level')
->relationship(name: 'level', titleAttribute: 'name'),
Select::make('gender')
->options(['0' => 'M', '1' => 'F']),
])
Fieldset::make('player')
->relationship('playerProfile')
->schema([
Select::make('level')
->relationship(name: 'level', titleAttribute: 'name'),
Select::make('gender')
->options(['0' => 'M', '1' => 'F']),
])
/app/Models/User.php
public function playerProfile(): HasOne
{
return $this->hasOne(PlayerProfile::class);
}
public function playerProfile(): HasOne
{
return $this->hasOne(PlayerProfile::class);
}
/app/Models/PlayerProfile.php
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
6 replies
FFilament
Created by LiruLiruLiru on 3/13/2024 in #❓┊help
Detect image in FileUpload to hide upload instructions
No description
3 replies
FFilament
Created by LiruLiruLiru on 12/20/2023 in #❓┊help
filament-actions::group label not working?
Hey guys! I'm trying to use the label for <x-filament-actions::group /> component without any luck, I just see the icon without the text. Has someone bumped into this issue? This is what I have
<x-filament-actions::group
:actions="[
$this->createFromTemplateAction,
$this->createNewAction,
]"
label="Actions"
icon="phosphor-caret-down"
iconPosition={{\Filament\Support\Enums\IconPosition::After}}
size={{\Filament\Support\Enums\ActionSize::Large}}
color="primary"
/>
<x-filament-actions::group
:actions="[
$this->createFromTemplateAction,
$this->createNewAction,
]"
label="Actions"
icon="phosphor-caret-down"
iconPosition={{\Filament\Support\Enums\IconPosition::After}}
size={{\Filament\Support\Enums\ActionSize::Large}}
color="primary"
/>
7 replies
FFilament
Created by LiruLiruLiru on 11/30/2023 in #❓┊help
Seeking Guidance on how to Inject Form State into Custom Layout
Hey Filament community, I'm currently working on a multi-step form using the Filament Wizard, and I've reached a point where I'd like to create a custom layout for a final "confirmation" view. This view should display a summary of all the data entered by the user before they submit the form. I already have my custom Layout for my confirmation view, but I'm facing a challenge in passing the form's state to this layout. I've explored various options without success, and I was wondering if someone could give some ideas or point me in the right direction. Additionally, I believe that this "confirmation" view would be a cool addition to Filament, especially for users navigating through multiple steps or tabs in a form. If there's interest, I'd be happy to contribute it as a pull request when I'm done with it. Thanks in advance!
4 replies
FFilament
Created by LiruLiruLiru on 11/16/2023 in #❓┊help
Issue with Form property not showing when using ->multiple() in Select field
Hey everyone! 👋 I'm currently facing an issue with my Filament form, and I could use some help. Problem: I have a form with a Select field using ->multiple() in the ->action() custom action. I'm not able to see my $data["fields"] even though it's defined in my form. Strangely, if I remove ->multiple() from my Select:: field, then I can see $data["fields"]. Code Snippet: Here's a snippet of my code:
Select::make('fields')
->label(__('forms.fields'))
->multiple()
->relationship(name: "fields", titleAttribute: "name")
->required(),
Select::make('fields')
->label(__('forms.fields'))
->multiple()
->relationship(name: "fields", titleAttribute: "name")
->required(),
Issue: $data["fields"] is not present in my action method when using ->multiple(). Expected Behavior: I expect to see $data["fields"] even when using ->multiple(). Documentation Reference: I have already read the documentation, which mentions that "multiple" options are returned in JSON format and recommends adding an array cast to the model property. I assume that it has to do something with this but for ->action, but haven't found a way to solve it. Additional Context: - I have already checked the form field name, and it matches the key used in $data. - I have added a dd($data) to check the content of $data, and the structure aligns with my expectations. If anyone has experienced a similar issue or has insights on why ->multiple() might be affecting the visibility of $data["fields"], please share your thoughts! Your help is greatly appreciated. 🙏 Thanks in advance!
4 replies
FFilament
Created by LiruLiruLiru on 11/6/2023 in #❓┊help
How Can I Customize Wizard's Steps in a More Minimalistic Way?
No description
2 replies