F
Filament15mo ago
dyo

Error when create new record

Maybe this is a silly problem, but i can't figure it out in hours.. I want to create data with form builder, but it return these error.. maybe some of you have ever experienced it, how can i fix it?
The error
the resource
the create page
the model
6 Replies
Filament
Filament15mo ago
We need more information to help you debug your problem. Please click on the top left 'SHARE' button of the error page you're seeing and share the link with us.
dyo
dyo15mo ago
Flare
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sidonat.1' doesn't exist (Connection: mysql, SQL: select count(*) as aggregate from 1 where slug = q3wewqrfwe) - The error occurred at http://localhost:8000/admin/campaigns/create
Dan Harrin
Dan Harrin15mo ago
i cant see where it is, but i think one of your form components is using 0 as a table name. remove the fields one by one and see which causes the problem
dyo
dyo15mo ago
hmm okay.. i'll check it.. thanks for your suggestion.. TextInput::make('slug')->label('url')->disabledOn('edit')->required() ->unique(static fn (Page $livewire) => $livewire instanceof CreateCampaign) ->dehydrated(static fn (Page $livewire) => $livewire instanceof EditCampaign), This component is generating the above error. What I want to achieve with this component is to make it unique in the create page and dehydrated when in the edit page. In addition to the slug being unique in the table, the slug cannot be edited. What can I do to fix the component so that it behaves the way I want it to?
LeandroFerreira
LeandroFerreira15mo ago
->disabledOn('edit')
->dehydrated(fn (string $context): bool => $context === 'create')
->unique(column: 'slug', ignoreRecord: true)
->disabledOn('edit')
->dehydrated(fn (string $context): bool => $context === 'create')
->unique(column: 'slug', ignoreRecord: true)
dyo
dyo15mo ago
this is works for me.. thanks..