Questions tagged [relationships]

Relationships refer to mappings between elements of one set to another set, such as one-to-one, one-to-many, many-to-many.

Relationships can be implicit or explicit depending upon the data model.

Types of relationships

References

832 questions
2
votes
2 answers

How can I get submitted testimonials for a user written by other users

I have a problem with getting all the testimonials submitted by other users to display them on the user profile of the user concerned (the user being reviewed). There are two tables. First the users table with id, name, email, photo, phone and…
Labelle Doriane
  • 105
  • 1
  • 3
  • 15
2
votes
2 answers

Display in VIEW of One to One relation in Laravel Relationship

I am here again with a trouble understanding the correct way of doing Laravel Relationships I have this User Model public function concessionaire() { return $this->hasOne('App\Concessionaire', 'meternum', 'meternum'); } and Concessionaire…
EasyWay
  • 365
  • 1
  • 5
  • 20
2
votes
2 answers

Audit belongsTo relationship in Laravel Eloquent

I have a model 'Contract' and a model 'ContractLine' in a classic master-detail relationship. In Laravel terms: the contractlines have a belongsTo relationship with a contract. I would like to audit all changes a user makes to his contracts. Not…
Kirk Olson
  • 554
  • 8
  • 16
2
votes
2 answers

Difference between use and realize relationships uml interface

what is the difference between use and realization interface relationships? How to implement them into code (e.g. java)? (Maybe better explanation of my question: I have one interface, say I and two classes, say A and B. Class A realizes I and class…
cristina7
  • 75
  • 8
2
votes
2 answers

HABTM relationship with an array

I am a beginner with Rails 3 programming and I have one problem with creating the right model. Let's say there is an application to manage the bibliography of a book, that is manage the mapping for each chapter of the list of referenced articles. So…
bitwelder
  • 1,095
  • 8
  • 11
2
votes
1 answer

Issue in counting relationships for nodes in Neo4j

I've got a Neo4j database in which hashtags and tweets are stored. Every tweet has a topic property, which defines the topic it belongs to. If I run the following query, I get the most popular hashtags in the db, no matter the topic: MATCH…
sirdan
  • 1,018
  • 2
  • 13
  • 34
2
votes
0 answers

Self referencing, STI, or polymorphic?

I'm having a really tricky time modeling this data problem. My application is basically a messaging app between two types of user object—users and admins. The data for each is the same, but their relationship to messages is slightly different. A…
2
votes
1 answer

How does laravel model relationships work in core?

Consider this example class SomeClass extends Model{ public function user(){ return $this->belongsTo('App\User'); } } $instance = SomeClass::findOrFail(1); $user = $instance->user; how do laravel know(i mean in core) that…
2
votes
3 answers

Laravel Eloquent relationship not an object when doing anything but dd()

I have a seemingly stupid and crazy situation. I have activity logs for users, my user model has this relationship in it: public function activityLogs() { return $this->hasMany(Log::class); } Pretty straight forward and when I check a single…
Styphon
  • 10,304
  • 9
  • 52
  • 86
2
votes
1 answer

Nested relations with Laravel 5.4 Eloquent

I'm new to both Laravel and Eloquent. I've built some straight forward projects which is just fine. Now I'm attempting to build a more complex platform and I'm really getting stuck on relations. Maybe the approach is wrong, if thats the case I would…
Peter
  • 21
  • 1
2
votes
1 answer

Can't filter through Relationship in Laravel Datatables

so i have a Laravel Datatables project and i'm trying to create a column that, when you click a specific value it will send an AJAX request to the PHP backend and will try to FILTER the results on the DataTable by a specific column and that value…
João Serra
  • 509
  • 9
  • 21
2
votes
1 answer

Rails3 + Typus: display habtm relationship as checkboxes

I'm managing my admin backend with Typus I want to add a field with a checkbox for each category. I used this code: Post: fields: default: name, description, user, categories list: name, description, user, categories form: name,…
2
votes
2 answers

Laravel Eloquent: Set relationships only if related data exists

I have some Eloquent models with relations to each other, but I want these relations to be set only if related data exists. For example: Department (Model) -> hasMany -> Worker (Model) (Relation should be set only if the department has related…
Moritz Büttner
  • 794
  • 1
  • 8
  • 20
2
votes
1 answer

A better example of ternary relationship

In SQL you can describe a binary relation with a table like Husband | Wife We know that an husband can have only one wife, and viceversa, so that's a 1:1 relationship, and you can specify costraints such that if you add an husband that is already…
Fabio Filippi
  • 1,732
  • 25
  • 40
2
votes
0 answers

Visual Studio 2015 Class Diagram Relationships

Is there any way I can add the types of relationships between classes in Visual Studio ? I already found out how to deal with associations, but now I need to deal with Dependency and Aggregation/Composition,I am using Visual Studio 2015 Community,…
Matthew
  • 105
  • 1
  • 11