Questions tagged [relationship]

Questions in this tag typically involve the association that a set of data has with other set(s) of data.

5577 questions
1
vote
1 answer

Laravel Relationship: Restrict One Asset per Issue but allow Issue to have Many Assets

tldr; prevent the same Asset from being attached to the same Issue more than once. I am creating a Problem DB for my school computer assetts. Currently I have a many to many relationship between Issue and Asset, along with pivot table of…
extensa5620
  • 681
  • 2
  • 8
  • 22
1
vote
1 answer

Calculate a metric based on two tables in Power BI

Within my model I need to calculate a measure based on two related tables. The schema would be something like this: On the table A I need to calculate a new metric called Bonus (Revenue*%bonus). I'm kind of new with this tool, and I have seen a…
d2907
  • 798
  • 3
  • 15
  • 45
1
vote
2 answers

saveMany() not storing data

Given the following models: Car Model - parts: hasMany(Parts::class) Part Model - car: belongsTo(Car::class) Running Car::find(1)->parts()->saveMany(Part::hydrate($request->parts)); properly returns a list of Parts, 3 have id, one does not, so…
Iskren
  • 1,301
  • 10
  • 15
1
vote
1 answer

Symfony Doctrine - Make fixtures with ManyToMany

I use Symfony 4.2 with Doctrine and I want to create fixtures with ManyToMany relationships with two entities : Organization Project But when I load fixtures the join table (organization_project) is always empty. So, I don't know if my…
Bonsai
  • 346
  • 3
  • 17
1
vote
0 answers

How to fix: Relationships between two pivot tables

Im trying to make a relationship in laravel between 3 tables. First we have the "decks" table, which contains the information of every deck with id of the owner. Then we have the "cards" table, which only contains the information for the cards.…
1
vote
1 answer

Any tools for relationship between XML files

I have a set of XML configuration files, which are long and complex. The structure is that some attributes are defined in a parent xml and are imported and overridden by the children xml. Because of 20 odd such files, it becomes confusing to…
Priya
  • 11
  • 1
1
vote
1 answer

Eloquent Relationship for Learning Management System using Laravel

I have three model for the LMS which are Course, Section and Lesson. So under course there are sections and under sections there are specific lessons. I already got the relationship for Course and Section but my problem is on the lessons. My Model…
1
vote
1 answer

Elasticsearch - excluding children from documents with join field

So I've set up an index with the following mapping: PUT test_index { "mappings": { "doc": { "properties": { "title": { "type": "text" }, "author": { "type": "text" }, …
Dioralop
  • 165
  • 1
  • 9
1
vote
1 answer

How to make relationships in cakephp3

I am trying to make the relationship between the tables, but can’t figure out what I doing wrong. I read The documentations in cakephp3, and tons of post in stackoverflow, and still can’t get any result. -------------------------- name …
Angel
  • 55
  • 1
  • 10
1
vote
1 answer

How to get a model relationship only if a given condition on parent model is met

I have a posts model, I need to get posts only from the channels the user belongs to if the channel is private or otherwise get all the posts from all the channels. Public channel can be viewed by everyone and every post belongs to a…
ManuEl Magak
  • 317
  • 3
  • 11
1
vote
1 answer

How to translate belongs-to relationship in voyager laravel admin

I am using voyager admin laravel that includes its own translations table and I have two tables categories and products that have a relationship, each product belongs to a category. Now when I fill products data and switch between languages category…
1
vote
2 answers

Neo4J find the number(SIZE) of relationships between nodes

I am trying to return a set of nodes where there is more than n outgoing relationships of the same kind. The specific use case is given a set of movies which actors have contributed to more than one of those movies. I have tried multiple methods of…
1
vote
1 answer

How to query a polymorphic Eloquent model providing the type and the id?

I have a polymorphic model Discussion and other models that are discussable. I have configured my morph map to translate project to App\Models\Company\Project which is discussable. I would like to write: function get_all_discussions($type, $id)…
nowox
  • 25,978
  • 39
  • 143
  • 293
1
vote
0 answers

Join Table with Multiple Where Condition in Laravel 5.0

I have 3 payout tables. All are grouping by 'mem_id'. Now I want to filter date wise search by any one of the table having the date period. This is my Code but its not working: $payout = Payout::join('tbl_payout2', 'tbl_payout.mem_id', '=', …
Karthik SWOT
  • 1,129
  • 1
  • 11
  • 15
1
vote
1 answer

Must be an instance of App, Relation, instance of Illuminate BelongsToMany returned

I've got one error when trying to attach a program in Laravel with belongsToMany Relationship. Someone that knows what I'm doing wrong? Controller $user = User::where('id', $request->input('user_id'))->first(); $program = Program::where('id',…
nahoj
  • 285
  • 1
  • 4
  • 16