Pivot table with extra json column
Is there any possibilty to save data (from a [TagsInput]-field) to an extra json column in a pivot table.
I get an ErrorException: "Array to string conversion". Do I have to apply a cast somewhere?
9 Replies
Can you show the code you've been trying?
PersoonRelationManager.php:
Persoon.php:
Document.php:
Migrations:
Have you tried casting to
array
instead of json
?yes, gives the same error
maybe a bug? or not yet implemented?
The cast on person is useless. Your person model doesn’t have the data. You need a pivot model and set it there
Can't find any documentation on a pivotmodel...
So I created a 'pivot model' named DocumentPersoon.php
How to use it in the relationmanager?
Pivot Model is Laravel related. Usage is in filament docs. Currently only on mobile so can’t search for you.
Thanks. Found it. Laravel Docs => Defining Custom Intermediate Table Models
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.