Questions in this tag typically involve the association that a set of data has with other set(s) of data.
Questions tagged [relationship]
5577 questions
1
vote
1 answer
Octobercms: clear $attachOne relationship
I have a problem updating an attachOne relation of a model from a frontend form under Octobercms.
I have a "Customer" model and relative controller with a field in the backend form where I, as admin, can edit its company logo.
I also have built…

Yuri Refolo
- 245
- 9
- 17
1
vote
1 answer
multiple pivot table laravel eloquent
I created 3 models and in my case I need to link the link of 3 models in the table:
user:
name
password
...
task:
...
task_status_id
task_status:
name
...
task_user:
task_id
user_id
but in my implementation me need task status for all…

Алексей Цапаев
- 37
- 5
1
vote
1 answer
How to get data from Laravel nested relationship?
I am new to Laravel. I'm having a lot of trouble getting a very-nested relationship to work correctly in laravel.
The wanted behaviour is as follows,
I have 5 Models. Purchase, Inventory, Slab, Scarting and FloorTile.
I have one to one relation…

nomie
- 47
- 5
1
vote
2 answers
how to get relationshipdata from csv-file containing all relationships in single line?
I want to build relationship graph in networkx for plants. In my csv-file, all data for these plants are contained on single line for each plant. For example: plant number, plant name, companion plants, antagonists. Now I want networkx graph where…

Jon H
- 33
- 1
- 8
1
vote
2 answers
Silverstripe 3: Unlink many many relationships
Is there a way to unlink the many_many relationships in SilverStripe 3 using code?
After a certain date, I want to unpublish a page and unlink all its many many relationships.
How can I do this?

subs
- 179
- 1
- 11
1
vote
1 answer
Laravel: How to create a hasManyThrough polymorphic Many-to-Many relationship?
Situation
I have the following models:
Post
Video
Tag
These are stored in the database tables:
posts (having id and name columns)
videos (having id and name columns)
tags (having id and name columns)
And also a table taggables with the…

Philip
- 2,888
- 2
- 24
- 36
1
vote
2 answers
How to retrieve details of second level tables in laravel relationships
I have 3 tables
bank(id, title),
employee(id, name, bank_id),
payroll(id, employee_id, salary).
Now I want to retrieve bank title of employee_id in payroll table.
I have set model relationships
class Bank extends Model
{
public function…

Raja Durai
- 65
- 1
- 10
1
vote
1 answer
Counting relations between two columns in SQL server
Good morning, I have two columns in sql studio and I need to count the relations between the elements one column and the other one. The problem is it seems only is counting in 'one direction' and I want to know both. Maybe it is easier if I show you…

Emmanuelle Crayon
- 63
- 5
1
vote
0 answers
Relationally assigning user-voted tags to items
I'm creating a site containing thousands of items. Among other things, users can vote to assign tags to items with the following logic:
Users can vote on any number of tags for every item.
The items can have any number of tags.
Any item gains the…

Morsby
- 56
- 7
1
vote
1 answer
Optimizing Eloquent Relationship Retrieval
I have an interface which displays a list of communities on the platform. Communities have members and in turn members/profiles can befriend one another. On the listing page each community card needs to display the number of members (in the…

Frisbetarian-Support Palestine
- 1,277
- 1
- 12
- 27
1
vote
0 answers
Use variable in relationship
I have some customfield functionality on my site where users can add custom fields to a model.
I've just found that if you enter data into one of the fields the same field won't show up for another model because of the way I get the empty fields for…

Theory
- 65
- 9
1
vote
2 answers
Neo4j cypher queries, counting nodes and two way relationships
I’m trying to run a cypher query on nodes with two way relationships and would like to count each of those relationships as well.
Example:
Nodes: store + customer
Relationships: sold + bought
In an ideal scenario, I’d want to see both…

Lulu
- 13
- 3
1
vote
2 answers
Complex Eloquent relationship
I have complex eloquent relationship.
company
-id
-name
company_courts
-id
-company_id
-name
company_sports
-company_court_id
-sports_id
sports
-id
-name
Company can have many courts.
Courts can have many sports
I want to get all sports…

Jaeyoung Heo
- 87
- 1
- 11
1
vote
1 answer
Laravel Defining Complex Relationships
I need help in defining relationships for the following tables
product
id
name
modifier
id
name
modifier_items
id
modifier_id
name
price
modifier_product
id
modifier_id
product_id
One Product may have multiple…

praveen.menezes
- 45
- 8
1
vote
1 answer
Django ForeignKey
I'm struggling to do a reverse search via the shell for a foreign key
models.py:
class Investor(models.Model):
first_name = models.CharField(max_length = 100)
last_name = models.CharField(max_length = 100)
def __str__ (self):
return '%s…

TMD
- 191
- 1
- 2
- 14