Top "Belongs-to" questions

This is a master-detail relationship where one item "belongs_to" another and has a foreign key to maintain the relationship.

Eloquent where condition based on a "belongs to" relationship

Let's say I have the following model: class Movie extends Eloquent { public function director() { return $this->belongsTo('Director'); } } Now …

laravel where eloquent belongs-to
Laravel Relationships

I've been looking over relationships in Laravel 4 in the documentation and I'm trying to work out the following. I have …

laravel belongs-to relationships laravel-4 eloquent
Validation failed Class must exist

I have been (hours) trouble with associations in Rails. I found a lot of similar problems, but I couldn't apply …

ruby-on-rails validation associations model-associations belongs-to
Rails belongs_to many models

I did find some questions on SO about Rails associations that are somewhat like my question, but for the life …

ruby-on-rails activerecord belongs-to
Should I use has_one or belongs_to in ruby on rails?

I want to have a Status model which will be relatively static after some user-defined set up (and different users …

ruby-on-rails belongs-to has-one
Does accepts_nested_attributes_for work with belongs_to?

I have been getting all kinds of conflicting information regarding this basic question, and the answer is pretty crucial to …

ruby-on-rails-3 nested-attributes belongs-to
Undefined property: Illuminate\Database\Eloquent\Relations\BelongsTo::$name laravel 5.4

Hi following are my relations User Model public function loginlogout() { $this->HasMany("App\Models\LoginLogoutLogs"); } and this is my …

php laravel-5.4 has-many belongs-to
Rails: belongs_to vs has_one

A bit of a newbie question on rails associations. I have a Bug model, and a Status model. Status is …

ruby-on-rails model associations has-many belongs-to
How it works - `belongs_to :user, dependent: :destroy`

I know how to work has_many :posts, dependent: :destroy. If User or something that has_many posts is destroyed, …

ruby-on-rails ruby has-many belongs-to
Rails: Non id foreign key lookup ActiveRecord

I want ActiveRecord to lookup by a non-id column from a table. Hope this is clear when I give you …

ruby-on-rails activerecord foreign-key-relationship has-many belongs-to