John Parker
Form Builder support for polymorphic relationships
I know you can create forms that perform CRUD operations on relationships by using
->relationship('<relationship property>')
, within Section, Group, etc.
However, I'm wondering what the cleanest approach would be to support polymorphic tables, where you'd need to be able to specify what the id
and type
field names are.2 replies
Setting value of relationship form field via $set closure
Does anyone know if it's possible to update a relationship field via the
$set
closure?
Specifically, I've a form field representing an underlying belongsToMany
relationship, which I need to be able to modify based on data that's fetched in the afterStateUpdated
method of another field within the form.
I've tried passing both the model instance itself and the instance's ID, but neither seems to work, so I'm wondering if there's some other approach I need to take.11 replies
Updating Form Field data from JavaScript
Is there any means of accessing Form Fields from JavaScript?
I need to be able to update the field contents and trigger a "has updated" event or similar from JavaScript. I know you can do this for Livewire components, but the Filament form fields don't appear to be exposed in this manner from what I can tell. I can of course simply update the DOM elements accordingly, but this feels wrong.
More fundamentally, is there a better approach to enabling interaction between JavaScript code and Fields?
3 replies
Resolve color name to CSS class(es)
Is there any public method which can resolve color names (such as
success
, warning
, etc.) to the underlying CSS class(es).
The reason I'm asking is that I'm creating a custom table column, and it makes sense to re-use the getColor
method which exists on an enum field that uses the HasColor
trait, however this returns the color name rather than something that can be output.2 replies
Eloquent `point` field type data triggers "Unexpected end of JSON input"
Is anyone using the
point
Eloquent field/attribute type in any of their models that have Filament resources? I've a resource that makes use of this which is failing with an "Unexpected end of JSON input" console error when attempting to view/edit a model which contains encoded point data. Attempting to create a new instance of the model initially works as expected, up until the point that the newly created model with the encoded data present is loaded.
Dropping the database column and disabling the custom model setters that set the data based on field inputs resolves the issue, so it would seem as first glance to be related to the way the encoded point data is handled by the JSON encoder. As such, I'm wondering if anyone has encountered anything similar before I go bug hunting/try and create a stripped back project to illustrate the issue.
I suspect this may be a Livewire v3 issue rather than a Filament one, but I thought I'd ask here first.13 replies
Recommended approach for replacing Filament login with Jetstream?
I'm creating a new Laravel 10 based project, which will use Jetstream on the frontend, hence the FIlament login will be somewhat redundant.
As such, I'm wondering if there's a easy/standard way to do this, rather than having duplicate login functionality?
24 replies