S. Mert ÖZTÜRK
image uploader to fill problem
Hi,
i'm trying to fill image uploader from model. This is model return;
attributes: array:11 [▼
"id" => 1
"model_type" => "App\Models\Modules\StaticPages"
"model_id" => 1
"description" => "test seo açıklama"
"title" => "test seo başlıkbb"
"image" => "{"23f1baac-917a-4cc5-8901-104329634cc3":"seo_content\/seo_content-1698319573-1785-ekran-grnts-2023-09-27-162143.png"}"
"author" => null
"robots" => "noindex, nofollow"
"canonical_url" => null
"created_at" => "2023-10-26 14:06:48"
"updated_at" => "2023-10-26 14:26:13"
]
Fill code;
->afterStateHydrated(function (Group $component, ?Model $record) use ($only): void {
$component->getChildComponentContainer()->fill(
$record?->seo?->only($only) ?: []
);
})
->statePath('seo')
->dehydrated(false)
->saveRelationshipsUsing(function (Model $record, array $state) use ($only): void {
$state = collect($state)->only($only)->map(fn($value) => $value ?: null)->all();
if ($record->seo && $record->seo->exists) {
$record->seo->update($state);
} else {
$record->seo()->create($state);
}
});
image uploader not see file, any advice?2 replies
Translatable plugin locale selector
Hi,
I have official translatable plugin and @kenepa Translation Manager. In this kenepa translation manager have language switcher on top right. My question is; can we do when kenepa language switcher after changed, official translatable manager locale select to changed.
2 replies
Livewire form submit button to Custom page header
Hi,
I have a form, I want to move the submit button of this form to the header. For this, I created an action in the header of my filament page, but how do I assign the function to this button?
My Filament Page :
protected function getHeaderActions(): array
{
return [
Action::make('update')
->requiresConfirmation()
->action(fn () => $this->update()),
];
}
Livewire comp:
public function update(): void
{
Settings::first()->update($this->form->getState());
}
livewire view:
<form wire:submit="update">
{{ $this->form }}
<x-filament::button type="submit" class="mt-6 w-full">
<span class="block" wire:loading.class="hidden"> Kaydet </span>
<span class="hidden" wire:loading wire:loading.class="block">Kaydediliyor...</span>
</x-filament::button>
</form>
And after submit i get this:
Method App\Filament\Pages\Settings::update does not exist.
2 replies
Save button in tabs form
Hi, i created tabs and create form inside this. But submit button is left out as you can see on image.
My form;
public function form(Form $form): Form
{
return $form
->schema([
Tabs::make('')
->tabs([
Tabs\Tab::make('Profile Info')
->schema([
TextInput::make('firstname')
->required(),
TextInput::make('lastname')
->required(),
TextInput::make('email')
->required()
->email()
->columnSpan('full'),
])
->columns(2),
Tabs\Tab::make('Password')
->schema([
TextInput::make('firstname')
->required(),
TextInput::make('lastname')
->required(),
TextInput::make('email')
->required()
->email()
->columnSpan('full'),
]),
Tabs\Tab::make('Clients')
->schema([
]),
]),
]);
}
public function create(): void
{
dd($this->form->getState());
}
And my livewire component;
<div>
<form wire:submit="create">
{{ $this->form }}
<button type="submit">
Submit
</button>
</form>
<x-filament-actions::modals/>
</div>
7 replies
External Data Create And Edit
Hi,
I work with whmcs and i want to create my custom client area with filament. But i see it, filament only make local database action (create, edit, list). In my laravel application i have my api end for get whmcs infos and save. How can i build create, edit and list resource to api.
10 replies