cj
cj
FFilament
Created by cj on 3/14/2024 in #❓┊help
Passing values to CreateAction for form population
found my answer. needed to set it through ->default on the form, and not by passing it in through the action...
->default(function ($livewire) {
if ($livewire != null && method_exists($livewire, 'getOwnerRecord')) {
return $livewire?->getOwnerRecord()?->id ?? null;
}

return null;
})
->default(function ($livewire) {
if ($livewire != null && method_exists($livewire, 'getOwnerRecord')) {
return $livewire?->getOwnerRecord()?->id ?? null;
}

return null;
})
3 replies
FFilament
Created by cj on 3/2/2024 in #❓┊help
How do I retrieve data from livewire component used in a resource form?
lol, this is my question! it got hijacked by the other poster. i don't need a livewire component for the example above. i need the livewire component for a much more complicated use. but the fact is i'm not sure how to get any data from my livewire component to be visible/saved by the filament form.
this is just a simple setup to help me understand.
16 replies
FFilament
Created by cj on 3/2/2024 in #❓┊help
How do I retrieve data from livewire component used in a resource form?
I'm more confused now. I don't think CGMaui's use case is like mine. I have a resource with a form and the form has a livewire component like so... Livewire::make(MyComponent::class) the associated blade is quite simple and looks something like this...
<div>
<input wire:model="logo"/>
</div>
<div>
<input wire:model="logo"/>
</div>
Now obviously there is more to it than this, but I'm trying to get a very basic component working. The component class right now, does almost nothing. It just has a couple of public fields to help me tie this together...
public ?MyModel $record = null;

public $logo = '';
public ?MyModel $record = null;

public $logo = '';
Now the only thing left to do is have it so that when the user submits the form, it grabs the text input and saves that to the 'logo' field of the given $record. Any idea how to pull that off?
16 replies