© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
paamayim

Is it possible to test a multiple select form?

Test body:
it('can create', function () {
    $tags = Tag::factory()->count(6)->create(); 
    $newData = Post::factory()->make();
 
    livewire(PostResource\Pages\CreatePost::class)
        ->fillForm([
            'tags' => $tags->keys(),
            'title' => $newData->title,
            // other fields ...
        ])
        ->call('create')

    // $this->assertDatabaseHas(...);
});
it('can create', function () {
    $tags = Tag::factory()->count(6)->create(); 
    $newData = Post::factory()->make();
 
    livewire(PostResource\Pages\CreatePost::class)
        ->fillForm([
            'tags' => $tags->keys(),
            'title' => $newData->title,
            // other fields ...
        ])
        ->call('create')

    // $this->assertDatabaseHas(...);
});

I have relation like https://laravel.com/docs/10.x/eloquent-relationships#many-to-many-polymorphic-relations

My filament form body:
Forms\Components\Select::make('tags')
  ->relationship('tags', 'name')
  ->multiple()
  ->preload()
Forms\Components\Select::make('tags')
  ->relationship('tags', 'name')
  ->multiple()
  ->preload()


When I try to run the test, I get the error: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Laravel - The PHP Framework For Web Artisans
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is it possible to sort options in a Select form field?
FilamentFFilament / ❓┊help
2y ago
Is it possible to have a required (non-nullable) Select Form Component?
FilamentFFilament / ❓┊help
17mo ago
Is it possible to format a new option created in a Select?
FilamentFFilament / ❓┊help
2y ago
Is it possible to lazy load a form?
FilamentFFilament / ❓┊help
2mo ago