lmtc
lmtc
FFilament
Created by lmtc on 10/3/2024 in #❓┊help
weird question - dynamically generated tailwind config file after form submission
So I have a cms where you can set global styles (not impacting my panels) I created a dynamically generated tailwind command that runs after form submission, but that won't impact the front end since it needs to run npm run build or have watch running, is this a terrible idea or is there a way to do this?
6 replies
FFilament
Created by lmtc on 8/22/2024 in #❓┊help
Saving data on modal submission builder
I have this code but it's not saving the full form when I submit:
->action(function (
array $data,
array $arguments,
Pages $record,
Set $set,
) {
$set('content_blocks.'.$arguments['item'].'.data.styling_options',
$data);
$record->save();
}),
->action(function (
array $data,
array $arguments,
Pages $record,
Set $set,
) {
$set('content_blocks.'.$arguments['item'].'.data.styling_options',
$data);
$record->save();
}),
10 replies
FFilament
Created by lmtc on 8/17/2024 in #❓┊help
HasMany Table Relationship pivot/group RelationManager
I have a table like: form_id | session_id | field_name | field_value 5 | 123 | first_name | john 5 | 123 | last_name | smith but I need it to be grouped like session_id | first_name | last_name any help would be appreciated!
12 replies
FFilament
Created by lmtc on 8/5/2024 in #❓┊help
Submitting form from Section header action
I'm trying to add some additional fields to a form, but it doesn't seem to be submitting. I have this in the action but $record seems to be null like it's not running mount:
->action(function (array $data,Config $record) {
$record->fill($data);
$record->save();
})
->action(function (array $data,Config $record) {
$record->fill($data);
$record->save();
})
5 replies
FFilament
Created by lmtc on 7/12/2024 in #❓┊help
Repeater default items not working in cluster
I have it set to default 1 I think because I have this mount it's not setting it to 1, can I force it to display all fields:
public function mount(): void
{
$this->record = Config::firstOrNew([
'config_type' => 'global_styling',
]);

$this->form->fill($this->record->attributesToArray());

}
public function mount(): void
{
$this->record = Config::firstOrNew([
'config_type' => 'global_styling',
]);

$this->form->fill($this->record->attributesToArray());

}
2 replies
FFilament
Created by lmtc on 7/10/2024 in #❓┊help
Auto add empty repeater based on a value in another field
I have a select input with a number of columns, I'd like the repeater to automatically add that many empty repeaters to fill in once the field is hydrated, has anyone done something similar? The examples I've found were filling in fields based on the db
4 replies
FFilament
Created by lmtc on 6/28/2024 in #❓┊help
Stuck on adding a livewire form modal as extraItemActions that is connected to another model
I have followed the steps on https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#setting-a-form-model and set up the modal using modalContent, I can see the form but the livewire isn't working for repeaters since the component referenced is still the parent page
Action::make('styling')
->icon('iconoir-style-border-solid')
->modalContent(function (){
$styling = new ItemStyling();
return view('livewire.forms.pages.item-styling',['styling'=>$styling]);
})
Action::make('styling')
->icon('iconoir-style-border-solid')
->modalContent(function (){
$styling = new ItemStyling();
return view('livewire.forms.pages.item-styling',['styling'=>$styling]);
})
Livewire Entangle Error: Livewire property ['stylingData.block_css'] cannot be found on component any help would be appreciated!
2 replies
FFilament
Created by lmtc on 6/15/2024 in #❓┊help
Livewire Form inside modal but with a different resource
Hi there, I have been trying to work through this for a while now and can't seem to see anything in docs or discord. I have a pages resource, inside that form I have an action modal which I've called in a livewire view as per docs, but it's just rendering the same form from my pages resource again, instead of pulling in the one from my styling modal class. Is there a way to set the relationship in the extraItemActions? This is my action:
->modalContent(function (array $arguments, Repeater $component, StylingModal $styling): View {

$block_id = $component->getItemState($arguments['item']);
$styling_data = $styling->getStyling($block_id['block_id']);

return view('livewire.forms.pages.styling-modal', [
'block_id' => $block_id['block_id']
]);
})
->modalContent(function (array $arguments, Repeater $component, StylingModal $styling): View {

$block_id = $component->getItemState($arguments['item']);
$styling_data = $styling->getStyling($block_id['block_id']);

return view('livewire.forms.pages.styling-modal', [
'block_id' => $block_id['block_id']
]);
})
2 replies
FFilament
Created by lmtc on 6/10/2024 in #❓┊help
Can I use a custom form field to pull in a form
I'm trying to create a custom form component that has a few fields and a repeater, but I can't seem to access the data in the modal that pops up:
->modalContent(function (array $arguments, PagesModel $record, Repeater $component): View {

$block_id = $component->getItemState($arguments['item']);


return view('filament.forms.components.styling-model', [
'record' => $record,
'block_id' => $block_id
]);
}),
->modalContent(function (array $arguments, PagesModel $record, Repeater $component): View {

$block_id = $component->getItemState($arguments['item']);


return view('filament.forms.components.styling-model', [
'record' => $record,
'block_id' => $block_id
]);
}),
Then the view:
<x-filament::section>
<x-filament-panels::form>
{{ $this->form }}
</x-filament-panels::form>
</x-filament::section>
<x-filament::section>
<x-filament-panels::form>
{{ $this->form }}
</x-filament-panels::form>
</x-filament::section>
and the form:
public function form(Form $form,$block_id,$data,$additional_fields=array()): Form
{return $form
->schema([])
}
public function form(Form $form,$block_id,$data,$additional_fields=array()): Form
{return $form
->schema([])
}
2 replies
FFilament
Created by lmtc on 5/24/2024 in #❓┊help
Add X repeater items
Has anyone modified the add repeater action to allow for specifying the number of repeater items to be created at once? I'm not sure how to go about it
5 replies
FFilament
Created by lmtc on 5/10/2024 in #❓┊help
Advise: Jetstream user profile without using views
I've currently got profile updates running using views to pull in the default views for things like 2fa but would rather have it all using fillament and just reference the functions, but can't seem to get it going - has anyone attempted this? I know I can style the view and I've tried the plugins but not getting it quite right
2 replies
FFilament
Created by lmtc on 4/6/2024 in #❓┊help
generating a unique id for each builder block
I'm a little stuck on this, trying to have a hidden field (ideally) that generates a UUID, which is fine when I create a new field but not when I clone using the builder clone action
TextInput::make('styling_id')
->default(function (
Get $get,
Set $set,
?string $state,
) {
if (($state ?? '') == ($get('../../styling_id') ?? '')) {
$state = Str::uuid()
->toString();
$set('styling_id', $state);
return $state;

}
}),
TextInput::make('styling_id')
->default(function (
Get $get,
Set $set,
?string $state,
) {
if (($state ?? '') == ($get('../../styling_id') ?? '')) {
$state = Str::uuid()
->toString();
$set('styling_id', $state);
return $state;

}
}),
4 replies
FFilament
Created by lmtc on 4/4/2024 in #❓┊help
Setting a field as part of a clone action
I've been playing around with this but couldn't figure it out, I want to modify the builder clone action so it sets a hidden field with a new UUID - as when you clone if you already have a value in there from default() it will keep the same value
2 replies
FFilament
Created by lmtc on 3/27/2024 in #❓┊help
Adding a value to a hidden field - or a suggestion
I'm trying to add a uuid to a hidden field in a builder component by default but it doesn't seem to be populating the value on load - I want to pass this value back into a different model as part of a builder action which is working but I just can't get the uuid in place:
->schema([
Hidden::make('form_styling_id')->live()->default(function() {
return Str::uuid();
}),
->schema([
Hidden::make('form_styling_id')->live()->default(function() {
return Str::uuid();
}),
6 replies
FFilament
Created by lmtc on 3/26/2024 in #❓┊help
getting the builder component id into a hidden field
I'm trying to add the same id I'm storing into a hidden field so I can pull in the values later, but can't seem to get it to populate?
BuilderComponent::make('fields')
->label('')
->collapsible()
->cloneable()
->live()
->reorderableWithButtons()
->addActionLabel('Add field')
->extraItemActions([
Action::make('add_styling')
->icon('heroicon-m-paint-brush')
->form([
Section::make('example')
->schema([TextInput::make('label')]),
])
->action(function (
array $data,
array $arguments,
FormsModel $record,
BuilderComponent $component
): void {
$item_id = $arguments['item'];

$record = new FormStyling();
$record->label = $data['label'];
$record->field_id = $item_id;
$record->save();

})
])
->blocks([
BuilderComponent\Block::make('text_field')
->label('Text Field')
->schema([
Grid::make(2)
->schema([
Hidden::make('form_styling_id')
->default(function (array $arguments, BuilderComponent $component) {
return $arguments['item'] ?? null;
}),
BuilderComponent::make('fields')
->label('')
->collapsible()
->cloneable()
->live()
->reorderableWithButtons()
->addActionLabel('Add field')
->extraItemActions([
Action::make('add_styling')
->icon('heroicon-m-paint-brush')
->form([
Section::make('example')
->schema([TextInput::make('label')]),
])
->action(function (
array $data,
array $arguments,
FormsModel $record,
BuilderComponent $component
): void {
$item_id = $arguments['item'];

$record = new FormStyling();
$record->label = $data['label'];
$record->field_id = $item_id;
$record->save();

})
])
->blocks([
BuilderComponent\Block::make('text_field')
->label('Text Field')
->schema([
Grid::make(2)
->schema([
Hidden::make('form_styling_id')
->default(function (array $arguments, BuilderComponent $component) {
return $arguments['item'] ?? null;
}),
5 replies
FFilament
Created by lmtc on 3/25/2024 in #❓┊help
Builder Action Form
Can I add additional form fields to builder components using actions without creating additional pages so it submits into the same builder component json? something like:
->extraItemActions([
Action::make('addStyling')
->icon('heroicon-m-paint-brush')
->action(function (array $arguments, Builder $component): void {
$itemData = $component->getItemState($arguments['item']);})
->form([
Section::make('example')->schema([
TextInput::make('field_label')
])
]),
->extraItemActions([
Action::make('addStyling')
->icon('heroicon-m-paint-brush')
->action(function (array $arguments, Builder $component): void {
$itemData = $component->getItemState($arguments['item']);})
->form([
Section::make('example')->schema([
TextInput::make('field_label')
])
]),
2 replies
FFilament
Created by lmtc on 3/17/2024 in #❓┊help
performance in forms
I have a ton of fields for a page builder, and I'm running into regular issues waiting to input into fields or for live ones to populate. Would using modal actions help?
7 replies
FFilament
Created by lmtc on 3/7/2024 in #❓┊help
Is there an easy way to store a section into a json field
I'm currently using a repeater but trying to simplify since I'm running into memory issues
3 replies
FFilament
Created by lmtc on 3/5/2024 in #❓┊help
error isEmailVerificationRequired() error
Currently I can't even do a composer update or install, fails on generate autoload, I saw someone else had the error on the discussion board on git but no resolution BadMethodCallException Call to undefined method App\Models\Forms::isEmailVerificationRequired() at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:67 63▕ * @throws \BadMethodCallException 64▕ */ 65▕ protected static function throwBadMethodCallException($method) 66▕ { ➜ 67▕ throw new BadMethodCallException(sprintf( 68▕ 'Call to undefined method %s::%s()', static::class, $method 69▕ )); 70▕ } 71▕ } i Bad Method Call: Did you mean App\Models\Forms::isRelation() ? +43 vendor frames 44 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}(Object(Filament\FilamentServiceProvider)) +5 vendor frames 50 artisan:35 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
4 replies