JSON relationship column in table
I have a table with a JSON column, like this:
In my model, I cast it as an array:
And in my resource table,
Using tinker, the column is saved on my table like this:
How should I define my relationship such that the resource table shows the name of the users? I havent used relationships that much so Im a bit confused π
1 Reply
I tried a belongsTo relationship, but that onlu showed the first user (user 4 as shown from tinker), and even then it was the whole record, and not the name.
Doing
TextColumn::make('collaborators.name')
would just give me an error
I dont need a pivot table for this, right?
I should also mention Im building this for a plugin. I dont have direct access to the User class