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!
Solution:Jump to solution
I got this working:
```
protected function getTableQuery()
return $this->record->submissions()->groupBy('session_id')->getQuery();
}...
8 Replies
Bumping this - I've currently done it as a custom view - but would prefer to have it as a normal table
Please example more..... I dont get field_name and form_id just remove them...
So I have a form resource which has an id, I generate a form and store each field name and label against a session id, I then want to group it by session id and have a column for first_name and last_name with the values under it
I have this working as a custom view but I'd rather use the default if it's at all possible
e.g
Id need to see the table/form you are suing to understand it better
The custom view?
This is my list submissions page:
Solution
I got this working:
Good work