Laravel aManyThrough in depth

I have been looking at documentation regarding the hasManyThrough relationship in Laravel, and fro some reason I am struggling with it as the documentation makes it look simple (maybe I am overthinking it).... I have three Models tables at the moment

Laravel relationship between two tables

I'd like your input on this. I have a Customer_table with a field name. I have another table called Reservation_table with a Customer_name field. How can I relate them in such a way that I'd see all the bookings by the specific customer?In Reservatio

Many-to-many relationship in Access from a single table

I browsed the web but couldn't seem to find an answer to my question. I know it is possible to create a Junction table between two tables in order to create a many-to-many relationship between them, but is it also possible to create a many-to-many re

Neo4j: Error When Adding Relationships Between Existing Nodes

When writing a query to add relationships to existing nodes, it keeps me warning with this message: "This query builds a cartesian product between disconnected patterns. If a part of a query contains multiple disconnected patterns, this will build a

Laravel 5.1 Delete Relationships

My models relationship is oneToMany eg: PatientToSample Patient_Model: class Patient_Model extends Model implements Jsonable{ use SoftDeletes; protected $table = 'patients'; public function samples(){ return $this->hasMany('App\Models\Sample_Model','

Laravel Define relationships

I have one table named Content which is a master table like Content : id content_name created_at updated_at and another table Course like Course table have many content_id Course : id content_id course_name created_at updated_at I have created relati

Laravel 5 eloquent relationships

I'm having problems when trying to make relations in my models. I've the objects Client and TypeOfClient. A Client has one TypeOfClient so my code is it: class Client extends Model { public function type() { return $this->hasOne('\App\TypeOfClient',

Symfony2 entity relationships do not work as expected

This is either a huge bug in Symfony2 or I'm just not getting it. I've spent literally days trying to understand what is going on here. I have two entities: Event Date I want a relationship where there are many dates to one event. Sounds simple enoug

How to CREATE TABLE with Disjoint Relationship in SQL

I am trying to create a table using a disjoint subtype relationship. For example, if the Supertype is furniture, and I have 3 Subtypes of furniture: chair, couch, and table. Then: CREATE TABLE Furniture (order_num NUMBER(15), desc VARCHAR2(20), type

Rails: belonging to polymorphic association + conditions

So I have this model: class Model < ActiveRecord::Base attr_accessible :to_id, :to_type belongs_to :to, polymorphic: true end I was wondering if I could add another relationship when belongs_to is on a specific type: class Model < ActiveRecord::Base

Laravel Eloquent relationships for siblings

Relationship for Siblings are many to many self relationship. So, for many to many self relationship, we can define two functions in the model: public function siblings() { return $this->belongsToMany('Student', 'student_sibling', 'student_id', 'sibl

Laravel Eloquent - belongs to many through

I have sites, pages, elements and element_creators tables, like this : sites id ... pages id site_id ... elements id page_id ... element_creators id element_id ... I'm able to retrieve element creators linked to a page $this->belongsToMany('ElementCr

Laravel Relationships (download by the user)

I get the following errors when i am trying to save the data with the file upload function because I have declared a new uploader_id to my table which should get its value from the relationship I wrote in the model. Illuminate \ Database \ QueryExcep

Symfony2 Doctrine gets a random product from a category

I have the following database scheme: table 'products' id category_id and of course a category table, just with an id. The data look something like that: Products -------------------- | id | category_id | -------------------- | 0 | 1 | | 1 | 1 | | 2

CakePHP 2.4.2: Contain does not work as expected

I have a model, Comment, that belongsto Module, Photo, Review, Article, and User. In turn, each of those models havemany Comment. User belongsto Avatar and Avatar hasmany User In the code below I successfully retrieve the latest 5 comments regardless

MS Access - Basic Relationship Error

I am trying to create a simple database of a theoretical car rental company. The following picture shows the relationships I currently have. However, when I try to assign more than one car to a single customer, I get the following error message: If a

MySQL foreign key when deleting

I am trying to figure out relationships and deletion options. I have two tables, User and UserStaff, with a 1:n relationship from User to UserStaff (a user can have multiple staff members). When my User is deleted, I want to delete all of the UserSta

Database query with relationships in Android

suppose I have the following tables sqlite> SELECT * FROM Artists; ArtistID|ArtistName 1 |Peter Gabriel 2 |Bruce Hornsby 3 |Lyle Lovett 4 |Beach Boys 5 |Supernatural sqlite> SELECT * FROM CDs; CDID|ArtistID|Title |Date 1 |1 |So |1984 2 |1 |Us |1992

Many-to-many relationship database

I have a student and faculty table. The primary key for student is studendID (SID) and faculty's primary key is facultyID, naturally. Student has an advisor column and a requested advisor column, which are foreign key to faculty. That's simple enough

Relationship 1-n

I dont get 1-n relationship. I have read some articles but still cant figure it out. I get 1-many, 1:1 and many-to-many. But what does 1-n mean?1-n is the same as 1-many