30 Days to Learn Laravel, Ep 11 - Two Key Eloquent Relationship Types

preview_player
Показать описание
For day 11, we'll focus exclusively on two Eloquent relationship types: belongsTo() and hasMany(). As you'll quickly find, these two will take you a very, very long way.

Рекомендации по теме
Комментарии
Автор

AWESOME!
"This relationship type is great for something, this relationship type is great for something, and this relationship type is great for something". I love this kind of additional explanation.

I work for a quarry company, I really need that kind of explanation.
I'm learning Laravel, because I want to manage whole of the company data with Laravel.

For me, as a newbie, Eloquent Relationship Type topic is the most interesting part in Laravel.

TrikNgonlen
Автор

Thanks Jeffrey, managed to make some stuff that I tought it was really hard by myself!

whisperscribe
Автор

The relationship: belongsToMany is so powerfull and the same time easy to use and thats why I love Laravel. Thanks for this serie :D See u next epsode <3

diegoskzero
Автор

thank you sir, youre really an awesome teacher

SatoKazumaLvl
Автор

In prev. video we've implemented Eloquent Relation b/w User and Employer Model,
but here it's basically b/w Job and Employer Model and that's understood by first API call being run that produced the response having data of job but containing empoyer_id as foreign key.

So, it'll clear the confusion for those who're facing any issue.
Regards,

MuhammadShoaib-hr
Автор

Nice. Please make a series of tutorial to cover all Eloquent relationships. 😘

grugbrain
Автор

I was asked from my internship tutor....

What is the definition of belongsTo in laravel... I said that it is used for defining the relationship of one to many.... He said that I am wrong.... then I said that it is used when we are trying to access the parent model via child He again said I am wrong....

Where I am wrong Jeffrey way ? I am kind of confused

myprojects
Автор

@jeffery sir their is one issue is that


> $employer->job;

WARNING Undefined variable $employer.


WARNING Attempt to read property "job" on null.

meme-swift
Автор

Hello, I got problem . in my code this employer function retruns null

NormanTavish
Автор

My example is
A man can have multipe wives, while a wife can only have a one husband?
Is it called one to many relationship?

kerimtim