Yohan
Yohan
FFilament
Created by Yohan on 7/30/2024 in #❓┊help
Customise the modal form view
What's the best way to personalise the view of the forms inside modal? My exact context is that I'd like to add a video (youtube) at the very bottom of my form. This form is currently configured on my VariablesRelationManager class, which is responsible for managing my Variable relationship. class VariablesRelationManager extends RelationManager { protected static string $relationship = ‘variables’; public function form(Form $form): Form { return $form ->schema([ FormsComponentsTextInput::make(‘name’) ->required()
6 replies
FFilament
Created by Yohan on 5/26/2024 in #❓┊help
Exporter Importer on JSON model fields
I need to be able to export and import data from my model. To do this, I use Filament's Import and Export functions. My problem is that my model has a field called variables_form which contains a JSON that can vary from one model to another. And I'd like to generate a different column in my CSV export for each of the json keys contained in this field. Example: {"59": "Move and store your furniture, without moving from your home", "60": "Need to store your furniture during construction? We'll collect and store it for you! Order redelivery from your cell phone with us.", "61": "Best box"} I'd like this JSON to generate 3 different columns in my CSV. I've seen that columns can be managed using the public static function getColumns(): array method, but I can't generate my columns dynamically here, as I don't have access to the Model (which is necessary in my case to know how the variables_form field is made up). So the question is quite simple, how to handle this case with the export feature ?
10 replies
FFilament
Created by Yohan on 11/21/2023 in #❓┊help
SaveFormAction : requiresConfirmation()
What I am trying to do : I just want to add a confirmation modal when the "save changes" button is clicked for My Edit{Resource}. To do that, I overrided the getSaveFormAction method (see code below) What I did : nothing and no errors in console or in the page Code :
php
<?php

namespace App\Filament\Resources\AdGroupResource\Pages;

use App\Filament\Resources\AdGroupResource;
use Filament\Actions\Action;
use Filament\Resources\Pages\EditRecord;

class EditAdGroup extends EditRecord
{
protected static string $resource = AdGroupResource::class;

protected function getHeaderActions(): array
{
return [];
}

protected function afterSave(): void
{
$this->dispatch('landing-page-saved');
}

protected function getSaveFormAction(): Action
{
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->requiresConfirmation()
->submit('save')
->keyBindings(['mod+s']);
}
}
php
<?php

namespace App\Filament\Resources\AdGroupResource\Pages;

use App\Filament\Resources\AdGroupResource;
use Filament\Actions\Action;
use Filament\Resources\Pages\EditRecord;

class EditAdGroup extends EditRecord
{
protected static string $resource = AdGroupResource::class;

protected function getHeaderActions(): array
{
return [];
}

protected function afterSave(): void
{
$this->dispatch('landing-page-saved');
}

protected function getSaveFormAction(): Action
{
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->requiresConfirmation()
->submit('save')
->keyBindings(['mod+s']);
}
}
Is there another way to accomplish that ?
6 replies