#1 - One to One relationship | hasOne() & belongsTo() | Laravel Eloquent Relationships

  Рет қаралды 123,707

QiroLab

QiroLab

4 жыл бұрын

In #Laravel #Eloquent Relationships, one-to-one relationship is a very basic and straightforward relation. In this video, we will look into "hasOne()" and "belongsTo()" with example.
𝐋𝐚𝐫𝐚𝐯𝐞𝐥 𝐄𝐥𝐨𝐪𝐮𝐞𝐧𝐭 𝐑𝐞𝐥𝐚𝐭𝐢𝐨𝐧𝐬𝐡𝐢𝐩𝐬 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭
• Laravel Eloquent Relat...
𝐃𝐢𝐠𝐢𝐭𝐚𝐥𝐎𝐜𝐞𝐚𝐧 𝐑𝐞𝐟𝐞𝐫𝐫𝐚𝐥
m.do.co/c/e740238537d0
Support my work:
1. On BuyMeACoffee: www.buymeacoffee.com/qirolab
2. On Patreon: / qirolab
Also, follow us on:
𝐅𝐚𝐜𝐞𝐛𝐨𝐨𝐤: qirolab
𝐓𝐰𝐢𝐭𝐭𝐞𝐫: / qirolab

Пікірлер: 113
@QiroLab
@QiroLab 3 жыл бұрын
Don't get left behind! Try Spec Coder: Supercharge Your Coding with AI! 👉 qirolab.com/spec-coder
@JohnSmith-xt8xu
@JohnSmith-xt8xu 2 жыл бұрын
Being an Core php developer was used to joins but was afraid of Relationships, but your tutorials has clear my all concepts and reservations, indeed relationships are much more better than Joins... Thanks.....
@iammuttaqi
@iammuttaqi 3 жыл бұрын
Oh my!!! It's another level.. 😍😍 Honestly i never seen anything like this
@rafablum
@rafablum 4 жыл бұрын
Great content !!! I'm starting in php and Laravel and I'm really enjoying the classes !!!!
@arafatkazi1728
@arafatkazi1728 3 жыл бұрын
I had watched your VUE basic series. Now I am watching this series. As usual, you are explaining things easily. Thankyou.
@QiroLab
@QiroLab 3 жыл бұрын
Glad to hear that
@rickie2086
@rickie2086 2 жыл бұрын
just started on Laravel, your explanation is clear, and simple to understand with good examples. thanks for all the hard work!
@QiroLab
@QiroLab 2 жыл бұрын
Thank you! Cheers!
@ashique12009
@ashique12009 Жыл бұрын
Impressive for the detail explanation, thank you!
@realadnoh
@realadnoh Жыл бұрын
Thank you Sir, very well explained. I like the style of different examples and alternative ways to understand how things work!
@QiroLab
@QiroLab Жыл бұрын
Glad you liked it
@nhanthien4854
@nhanthien4854 4 жыл бұрын
Video is so greate! Hope you can give more tutorials :))
@Ajtex
@Ajtex 3 жыл бұрын
wow, this tutorial help me to clear my concept of the Laravel relationship. Great bro....👌
@QiroLab
@QiroLab 3 жыл бұрын
Glad to hear that
@lakmalsampath3753
@lakmalsampath3753 Жыл бұрын
Great tutorial , clean and clear thanks for this valuable video 👍
@QiroLab
@QiroLab 6 ай бұрын
Thank you
@DennisHorn1981
@DennisHorn1981 3 жыл бұрын
Excellent explanation! Thank you!
@QiroLab
@QiroLab 3 жыл бұрын
Glad you enjoyed it!
@xaceplayz
@xaceplayz 3 жыл бұрын
i finally understood it. thanks a lot man
@QiroLab
@QiroLab 3 жыл бұрын
Glad to hear that!
@SuvroImran
@SuvroImran 3 жыл бұрын
Thank you so much. I appreciated.
@QiroLab
@QiroLab 3 жыл бұрын
You're very welcome! Glad you enjoyed it!
@florentinflo1727
@florentinflo1727 2 жыл бұрын
Very good one!
@dfordemo981
@dfordemo981 2 жыл бұрын
thanks for the awesome informative content
@QiroLab
@QiroLab 2 жыл бұрын
Glad you liked it!
@sasikala5652
@sasikala5652 3 жыл бұрын
Thank you sir.
@BiggiDroid
@BiggiDroid 3 жыл бұрын
Love this ❤️
@QiroLab
@QiroLab 3 жыл бұрын
I'm so glad!
@md.muhidislam9085
@md.muhidislam9085 3 жыл бұрын
Love it!
@QiroLab
@QiroLab 3 жыл бұрын
So glad!
@husnainnutkani4100
@husnainnutkani4100 2 жыл бұрын
If you guys are facing " Call to undefined function factory()" fatal error then use \App\Models\User::factory()->count(3)->create();
@dfordemo981
@dfordemo981 2 жыл бұрын
now it is actually \App\Models\User::factory(3)->create();
@bhawanisingh3671
@bhawanisingh3671 3 жыл бұрын
You have cleared my all dout Before see this video i very confuse Thank you sir I really thanks by heart
@QiroLab
@QiroLab 3 жыл бұрын
You are most welcome
@haiqalhalim6722
@haiqalhalim6722 Жыл бұрын
Your explanation about behind the scene how eloquent relationship work, what happen when change method name, that part really help me to understand more about this topic. thank you sir..
@QiroLab
@QiroLab 6 ай бұрын
Thank you
@manishkushwaha-je6xy
@manishkushwaha-je6xy 2 жыл бұрын
Tnq Very much sir...
@nuruzzanamhimel5911
@nuruzzanamhimel5911 2 жыл бұрын
sir, you r the great
@monodeeproy4939
@monodeeproy4939 2 жыл бұрын
Great !!
@quachvietcuong4940
@quachvietcuong4940 3 жыл бұрын
so helpful tks u. this video is make me to another level
@QiroLab
@QiroLab 3 жыл бұрын
Happy to hear that!
@mraihan19
@mraihan19 3 жыл бұрын
it's superb. it's make's the laravel's hard things easy.
@QiroLab
@QiroLab 3 жыл бұрын
I'm so glad!
@arammarm
@arammarm Жыл бұрын
Thank you man!!
@QiroLab
@QiroLab 6 ай бұрын
Thank you! Cheers!
@worldcorrectknowledge
@worldcorrectknowledge 4 жыл бұрын
Appreciated
@eMebyMonicaMateu
@eMebyMonicaMateu 2 жыл бұрын
Many thanks again!
@QiroLab
@QiroLab 2 жыл бұрын
You are welcome
@rubelmahamud3648
@rubelmahamud3648 3 жыл бұрын
thanks a lot .
@orbitsdev5904
@orbitsdev5904 Жыл бұрын
sir what extension did you used. for auto generate method 9:59
@ellsonmendesYT
@ellsonmendesYT 3 жыл бұрын
incredible :)
@QiroLab
@QiroLab 3 жыл бұрын
Glad you like it!
@cubedev4838
@cubedev4838 Жыл бұрын
Very deep explaination
@QiroLab
@QiroLab 6 ай бұрын
Thank you! Cheers!
@moathelmarmori457
@moathelmarmori457 Жыл бұрын
Thank you so much
@QiroLab
@QiroLab 6 ай бұрын
Thank you! Cheers!
@shahriarshaon1626
@shahriarshaon1626 3 жыл бұрын
Thank you very much sir
@QiroLab
@QiroLab 3 жыл бұрын
Most welcome
@rohankumar1475
@rohankumar1475 4 жыл бұрын
hello, i want to how this query write in laravel ORM(without where and with where) "select @t, @t from students INNER JOIN cities on student.city_id=@t" where students.id=1 i have student table with city_id and other columns and cities table with id,city
@godofredoauditor8091
@godofredoauditor8091 2 жыл бұрын
Thank you
@QiroLab
@QiroLab 2 жыл бұрын
You're welcome
@justicetout
@justicetout 3 жыл бұрын
Thank you.
@QiroLab
@QiroLab 3 жыл бұрын
You're welcome!
@omermalik280
@omermalik280 3 жыл бұрын
i have this error General error: 1364 Field 'name' doesn't have a default value (SQL: insert into `users` (`updated_at`, `created_at`) values (2020-11-18 06:13:56, 2020-11-18 06:13:56)).i want to create a post using relation. kindly guide. fetching is working. inserting/creating using relation is not.
@mdkhairul4640
@mdkhairul4640 2 жыл бұрын
Superb video
@QiroLab
@QiroLab 2 жыл бұрын
Thank you so much 😀
@themonster4759
@themonster4759 9 ай бұрын
thanks QiroLab as a muslim i should say thanks
@QiroLab
@QiroLab 6 ай бұрын
Thank you! Cheers!
@AWidiyanto
@AWidiyanto 3 жыл бұрын
Hi, Qiro. How to get user that has address then return it thru controller as json ?
@ralphjadegarcia8973
@ralphjadegarcia8973 Жыл бұрын
have you tried a composite relationship?
@johnsailor3590
@johnsailor3590 3 жыл бұрын
What if you have user that hasOne phone and you do not want to create new phone you want to associate the id from existing phone i dont find any example
@hopnguyen5948
@hopnguyen5948 3 жыл бұрын
thank u so much
@QiroLab
@QiroLab 3 жыл бұрын
You are most welcome
@bulbul-dev
@bulbul-dev 3 жыл бұрын
how can I save record user andress table using form ?
@ahmedaliklay1233
@ahmedaliklay1233 Жыл бұрын
شكرا لك
@QiroLab
@QiroLab 6 ай бұрын
Thank you
@neEs6624
@neEs6624 10 ай бұрын
A wesome 🎉
@QiroLab
@QiroLab 6 ай бұрын
Thank you! Cheers!
@darkestbrush507
@darkestbrush507 2 жыл бұрын
please write application logic in the controller !
@jorgeperalta9780
@jorgeperalta9780 4 жыл бұрын
thanks
@QiroLab
@QiroLab 4 жыл бұрын
You're welcome!
@thienngothanh1040
@thienngothanh1040 2 жыл бұрын
nice tutorial
@QiroLab
@QiroLab 2 жыл бұрын
Thanks
@motu0427
@motu0427 2 жыл бұрын
can u help me plzz how i send data using 1 form into 2 diffrent tables
@omedjamal7509
@omedjamal7509 2 жыл бұрын
all searches end with you. you left nothing on eloquent relations. many thanks.
@QiroLab
@QiroLab 2 жыл бұрын
Glad to hear that!
@JamesAutoDude
@JamesAutoDude Жыл бұрын
I'd have to say relationships is the hardest part of laravel for me. I hope this will help me 😫
@boilingsoup
@boilingsoup 9 ай бұрын
Need to know database modeling first then it'll make sense
@JamesAutoDude
@JamesAutoDude 9 ай бұрын
@@boilingsoup as an update it's sooo much easier with Laravel compared to my old horrible spaghetti code haha. I learned the proper formats and database modeling, structure, etc - and it's great!
@Omar-dp8ob
@Omar-dp8ob 2 жыл бұрын
my laptop doesn't have the authenticate file with the passwords, how did you get it
@Ehsankhan0577
@Ehsankhan0577 2 жыл бұрын
make a tutorial series on solid principles in Laravel
@akshaygireesh9568
@akshaygireesh9568 3 жыл бұрын
Plz provide the code to download
@rusirunethmina6241
@rusirunethmina6241 2 жыл бұрын
ErrorException Trying to get property 'country' of non-object sir this my error..how can sloved this
@toufikforu
@toufikforu 2 жыл бұрын
Hi, i need a help for find Logged in user id. $colorlist = User::find(1)->getCompany; instant of find(1) i need to find here Login user id. am using this hasMany relationship to display a table comments on my view. Please help me for this syntax, how i can use this. currently am getting data by find(1). need to make it dynamic by logged in user id.
@lochawala
@lochawala 4 жыл бұрын
can you please share which extension you using for this all suggestion?
@QiroLab
@QiroLab 4 жыл бұрын
I have installed "PHP Intelephense", "Laravel 5.6 Snippets", "Laravel Model Snippets" and "Laravel Blade Snippets" extensions in my VSCode editor.
@UmayangaWjesinghe
@UmayangaWjesinghe 3 жыл бұрын
what is the used version of Laravel for this example .. is Laravel 5.6 or 5.8 ???????? please tell me
@QiroLab
@QiroLab 3 жыл бұрын
In the video, it is Laravel 6. And this tutorial works in every version of Laravel.
@primawirawan7901
@primawirawan7901 3 жыл бұрын
i got some errors in this part Trying to get property 'country' of non-object {{$user->address->country}} can anyone help me
@varisinet7245
@varisinet7245 3 жыл бұрын
check you created an address for every user, means you should enter every user's country in address table.
@PraveenKUmar-tp6su
@PraveenKUmar-tp6su 3 жыл бұрын
@@varisinet7245 i too facing the error thank you bro i was stuck for an hour really thank you
@dfordemo981
@dfordemo981 2 жыл бұрын
im using docker in ubuntu too, but i want to set the environment setup with web server and work with laravel, i did all but when i run migrations, it says mysql driver etc is missing, i found no working solution to this problem, would you please make a seperate a video to this problem and mention me here, i followed your channel and ringed the bell icon xampp , PHP, mySQL, run laravel project, run phpmyadmin, run migrations too
@QiroLab
@QiroLab 2 жыл бұрын
I guess, you have not installed `php-mysql` in the docker.
@jjplays404
@jjplays404 2 жыл бұрын
is this laravel version 8 ? or some different version?
@QiroLab
@QiroLab 2 жыл бұрын
This is not Laravel 8. These syntax is valid in Laravel 8 and 9 as well.
@haronurrashid5661
@haronurrashid5661 4 жыл бұрын
I am the 13th viewer
@jobanjitsingh3416
@jobanjitsingh3416 4 жыл бұрын
hi sir add all relation
@QiroLab
@QiroLab 4 жыл бұрын
sure, I will create all Laravel Eloquent relations video.
@nishanthanr605
@nishanthanr605 3 жыл бұрын
Dont use Dark theme while recording.. The code not visible
@QiroLab
@QiroLab 3 жыл бұрын
Thanks for your suggestion. I have switched to the material theme. It is still a dark theme, but I think it is more visible. Watch recent videos and give your opinion. Is it okay now?
@wmafendi
@wmafendi 10 ай бұрын
comey fu
@codeimpression
@codeimpression 3 жыл бұрын
good knowledge.. but explaining capacity is poor..plz explain in detail. do not run fast in the video
@QiroLab
@QiroLab 3 жыл бұрын
Sorry for that. I am trying to improve. thank you for your feedback.
Eloquent Relationships in Laravel - All you need to know!
21:38
coder awesome
Рет қаралды 42 М.
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 104 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 99 МЛН
HAPPY BIRTHDAY @mozabrick 🎉 #cat #funny
00:36
SOFIADELMONSTRO
Рет қаралды 13 МЛН
Why Don't We Have A Laravel For JavaScript?
12:36
Theo - t3․gg
Рет қаралды 89 М.
Laravel Pivot Tables: Simple to Advanced Many-to-Many
12:24
Laravel Daily
Рет қаралды 119 М.
Introduction To Eloquent | Laravel For Beginners | Learn Laravel
45:20
PHP is the future
34:27
Aaron Francis
Рет қаралды 169 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,1 МЛН
Опять съемные крышки в смартфонах? #cmf
0:50
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1,2 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 11 МЛН