No video

Laravel 6 Advanced - e3 - Polymorphic Relationships

  Рет қаралды 75,428

Coder's Tape

Coder's Tape

Күн бұрын

Пікірлер: 178
@arvindbhardwaj3154
@arvindbhardwaj3154 3 жыл бұрын
This is free gold available for everyone. Thanks man!!
@JackbearAmine
@JackbearAmine 5 жыл бұрын
Thank you for all of your efforts in explaining Laravel for us in easiest way. May the success that has come your way today lead you to a bigger achievement in the years to come.
@orangecode1902
@orangecode1902 5 жыл бұрын
this Guy Deserve Hundred Million Subscribers you are Awesome Love from Pakistan
@CodersTape
@CodersTape 5 жыл бұрын
Thanks!
@divinealien7620
@divinealien7620 4 жыл бұрын
I agree these videos and codes are so clean RESPECT
@axeman2638
@axeman2638 5 жыл бұрын
You've got a really nice knack from explaining things clearly in simple and straight forward language. Thanks very much for you tutorials. Great work.
@CodersTape
@CodersTape 5 жыл бұрын
Thanks
@axeman2638
@axeman2638 5 жыл бұрын
@@CodersTape ,Thank you, I've been following your Laravel tutorial series, I think it's better than the laracasts tbh. Better structure and logical flow from concept to concept and more clearly explained. The laravel documentation is pretty opaque as well and I've not found it of as much help as your stuff. Cheers, keep it up.
@Chmelewsky
@Chmelewsky 2 жыл бұрын
this is one of the best laravel tutorials i've seen. subscribed!
@dopplereffect7325
@dopplereffect7325 5 жыл бұрын
Please I want to thank you for all the tutorials you have put on KZbin ,the way you explain is great. What you put here is the best of all I have had before. Udemy courses cost a lot in my currency ,having this kind of content here for free I what I can't describe, thanks personally you been of great help to me ,keep going ahead
@pavanobhan1105
@pavanobhan1105 2 жыл бұрын
You are awesome. I was having hard time understanding the relationship concepts through documentations. After watching your video, now I have crystal clear idea on relationships. Thanks a lot. Subscribed.
@JiteshDhamaniya
@JiteshDhamaniya 4 жыл бұрын
You are a hell of teacher mate. kudos to your efforts. on side note - in this tutorial you said "able" as in imageable is reserved and you must use it, which I believe is not the case. you can really use any name as far as you using same function name in morph model. Like If you using nice as function name for returning return $this->morphTo(); you can then use column name accordingly like nice_id and nice_type and this would work too. public function nice() { return $this->morphTo(); } and then you use nice_type and nice_id, in place of imageable_type and imageable_id.
@feranmiafrica9528
@feranmiafrica9528 5 жыл бұрын
Just when I've thought I've know all in laravel this came up.. Victor thank you for your efforts in making us how we are today... May you continue to grow in knowledge, wealth and in good health 😍 like if you love VICTOR
@CodersTape
@CodersTape 5 жыл бұрын
Thanks! All the best!
@colinrdixon
@colinrdixon Жыл бұрын
puts it all into perspective!! super appreciate you for this video.
@RecklessCoder
@RecklessCoder 5 жыл бұрын
Great Video! Only thing I'm missing is the Relation::morphMap which can be configured in the boot method of the AppServiceProvider. That way the namespaces won't show up in the database like 'App\\User' but for instance as 'user'. That way, when a model gets moved to another namespace you don't have to write migrations, but just change it namespace in the AppServiceProvider.
@CodersTape
@CodersTape 5 жыл бұрын
That's a good point but to be honest I have never had to move a model from their original namespace. Did you have a need to move a model's namespace in a project?
@RecklessCoder
@RecklessCoder 5 жыл бұрын
Coder's Tape yes. Currently I’m working on very large projects. Very often we move models from the models-namescape to modules where they belong. The morphMap then comes in handy
@CodersTape
@CodersTape 5 жыл бұрын
@@RecklessCoder that sounds like a great use case.
@veekly72
@veekly72 2 жыл бұрын
Nice coaching. thank you. you make it easier for me I was stuck in these relations.
@alisleem1626
@alisleem1626 3 жыл бұрын
Thanks Alot , You are really one of my favorites code mentors if not the best. i never understand topics comprehensibly except from u. i am really thankful for ur existence and efforts please keep going . I hope just one more thing i really wanna follow u doing a big project applying many concepts of what u teach using laravel 8 . Hope u will consider that in near future and thanks in advance. Love From Egypt ))
@UdanaUdayanga
@UdanaUdayanga 4 жыл бұрын
please continue this amazing channel. we miss you very much
@rahafmoute4781
@rahafmoute4781 Жыл бұрын
Thanks very very match its the most useful course i have ever been seen, I hope to add written english sentences of your speaking to can strangers understand more
@YusnielBrocard
@YusnielBrocard 4 жыл бұрын
@Coder's Tape your videos are awesome!!!
@SuperBatiskaf
@SuperBatiskaf 4 жыл бұрын
Victor, you are the best lector - nothing more, everything in the case
@CodersTape
@CodersTape 4 жыл бұрын
Thanks
@dardi71
@dardi71 5 жыл бұрын
unbelievable , how can you code without doing any mistake ???? .... keep going you are the best!
@ProgrammingwithPeter
@ProgrammingwithPeter 5 жыл бұрын
he scripted before and maybe done this at least once(or not) depending of how complex is the concept. I don't like that personally but he explains so well the concepts, a lot bettern than me, but i don't script anything.
@hieunguyenac4675
@hieunguyenac4675 4 жыл бұрын
​@@ProgrammingwithPeter yes, he saved a lot of time for watchers, you should learn about this, just personal opinion 😁
@ProgrammingwithPeter
@ProgrammingwithPeter 4 жыл бұрын
@@hieunguyenac4675 I know that he saved a lot of time for the viewers, but i just don't like this style, i always tried to find someone who builds real projects, even if it takes a lot more time, i can learn more and see the flow of developing, that's why i'm doing it right now myself. But, there are more people that prefer scripted . It's not my style. But again, I'm doing a different thing, he teaches you concepts, i build projects
@linguapharm
@linguapharm 4 жыл бұрын
Yes! Keep going plz, Professional coders don't do mistakes! And YES! he is the best.
@AmeerulIslam
@AmeerulIslam 4 жыл бұрын
@@ProgrammingwithPeter he builds projects too
@coolcha
@coolcha 4 жыл бұрын
This video was so nice. It made such a complex topic so much simpler to follow and with examples.
@robbradley1337
@robbradley1337 5 жыл бұрын
Liked, then watched.
@niruddhaRoy
@niruddhaRoy 4 жыл бұрын
I am thinking that how could you describe the deeping digger terms of laravel so easily, You rock man. Looking more from you....
@minpolik
@minpolik 5 жыл бұрын
There's a ->morpths() method you can use in migrations to create both columns and index them
@CodersTape
@CodersTape 5 жыл бұрын
Yup
@Ibenyeugbala
@Ibenyeugbala Жыл бұрын
Thanks for the clear explanation
@deepakthapa9528
@deepakthapa9528 3 жыл бұрын
Very useful...and practical.
@acedecastro83
@acedecastro83 5 жыл бұрын
The best teacher, as always! I hope you could also make a tutorial on how you implement table pagination (or a datatable in that case) in Vue.js with data (JSON) coming from Laravel as the backend. Thank you for all your work/content. Also, I just bought your first course in Udemy. I hope you publish more courses soon :)
@pembatamang5716
@pembatamang5716 4 жыл бұрын
Wow..thanks for the clear explanation
@VadimBesedin
@VadimBesedin 3 жыл бұрын
As alternative, we can have an "image_id" in each of the tables that require an image (Users, Posts, etc)
@hamzaaslam697
@hamzaaslam697 3 жыл бұрын
i was also thinking one thing with polymorphic concept i think this DB can't be used with any other language .Please correct me if i am wrong
@mohamedshuaau632
@mohamedshuaau632 3 жыл бұрын
@@hamzaaslam697 technically it can be used. Polymorphic can be implemented yourself
@omiorangsha665
@omiorangsha665 5 жыл бұрын
we are waiting for full course of it
@2509killer
@2509killer 4 жыл бұрын
Sehr verständlich und praktisch erklärt! 👍
@lysokkong5826
@lysokkong5826 4 жыл бұрын
Crystal clear explanation.
@asada4297
@asada4297 3 жыл бұрын
amazing tutorial explain really well thank you Sir,
@codeology1
@codeology1 5 жыл бұрын
Amazing Tips ... Master of laravel
@Hipocondriax
@Hipocondriax 5 жыл бұрын
I'm here, tnx!
@AwakeningofAI
@AwakeningofAI 4 жыл бұрын
clean explanations mate. very easy to understand. thanks.
@rahulxcr
@rahulxcr Жыл бұрын
Thanks. This is really awesome.
@nikhildhakal3727
@nikhildhakal3727 5 жыл бұрын
Really well explained video. Just the thing I needed for advanced laravel. Thanks
@mirzawajid7823
@mirzawajid7823 2 жыл бұрын
Very well explained! Love from Pakistan.........
@toshikverma8606
@toshikverma8606 2 жыл бұрын
i can like this 100 times
@mmtrrz
@mmtrrz 3 жыл бұрын
I just love this intro music 😍
@asifsarfraz2994
@asifsarfraz2994 5 жыл бұрын
thank you so much for your work.please make a video on add to cart and add to wishlist topic
@adam192021
@adam192021 5 жыл бұрын
The BEST as always!
@badralwattar5799
@badralwattar5799 3 жыл бұрын
thank you man, you are the best
@lionelguaregua820
@lionelguaregua820 3 жыл бұрын
Great content Bro, I have a lot of time without use this kind of relation, and i forgot the uses cases for it. Thanks, you have my sub
@sergiovalera3227
@sergiovalera3227 4 жыл бұрын
You’re simply the best.
@mel-182
@mel-182 3 жыл бұрын
I always come back for reference here lol
@SinghatehAlagie
@SinghatehAlagie 5 жыл бұрын
Mistake is the key of understanding when ever you did mistake in things you will understand that more than the others, that’s why every programmer should learn how to solve mistakes which in the language call debugging. And I am a programmer as well but I love to do some mistakes when coding just to disturb my brain 🧠
@anchalpandey9074
@anchalpandey9074 5 жыл бұрын
I'm just in love love with your channel 💓💓💓you post the moooost valuable content that no other channel post Ur amazing 🙇 💙💙💙
@CodersTape
@CodersTape 5 жыл бұрын
Thanks!
@hasim.infotechsolz
@hasim.infotechsolz 3 жыл бұрын
Really helpful! ❤️
@muhammedmusthafa6501
@muhammedmusthafa6501 3 жыл бұрын
woow ,nice tutorial man
@milad5554
@milad5554 4 жыл бұрын
That was exactly what i wanted today ! Thanks
@santiagos4290
@santiagos4290 3 жыл бұрын
Very clear ;)
@user-sg8op9gi3v
@user-sg8op9gi3v 4 жыл бұрын
thank you for the videos !!! I appreciate you so much from japan!!! your videos help me out so much thank you :)
@gazorbpazorbian
@gazorbpazorbian 5 жыл бұрын
Dude, your videos are awesome. To improve on your channel you should use video cards and reference your older videos to this one.
@jayedkhan1903
@jayedkhan1903 5 жыл бұрын
Your video quality really good. I love your all video. Please make a video about deployment on shared hosting. And how to process those jobs. Its really important couldn't find any solution
@asdasdasdasdasdas441
@asdasdasdasdasdas441 4 жыл бұрын
THE MAN of youtube killing it totally best teacher around
@CodersTape
@CodersTape 4 жыл бұрын
Thank you
@alxetd
@alxetd 5 жыл бұрын
Great video!
@christophrumpel
@christophrumpel 4 жыл бұрын
Great video 👍
@CodersTape
@CodersTape 4 жыл бұрын
Thanks Christoph
@afsanehshamsi
@afsanehshamsi 4 жыл бұрын
that's great.thanks a lot.
@konstruktion
@konstruktion 4 жыл бұрын
Please release more examples, like combine with controller, view and so. :)
@hurlimanjumamuratova2425
@hurlimanjumamuratova2425 Жыл бұрын
Good day, you rock!!! I fell in love with your coding environment, your font, your background && code colors... Could you please tell me what do you use for them?
@ripon59
@ripon59 11 ай бұрын
Sir, your explanation is really pro level & easy to understand. I just have one question about larage amount of data set. Like social media type platform. Do you prefer/mean , is it good practice for the large amount of data set ?
@asditaprasetya
@asditaprasetya 5 жыл бұрын
Wow thanks
@AMoktar
@AMoktar Жыл бұрын
Thanks bro, ❤
@rudestewing
@rudestewing 4 жыл бұрын
Thank you. it's really helpful.
@TH3BADRO
@TH3BADRO 5 жыл бұрын
Great tutorial. Thank you!
@ahmedwaqar1588
@ahmedwaqar1588 4 жыл бұрын
Oh man, you are so good at coding :)
@numenor21
@numenor21 5 жыл бұрын
Hey bro, thanks total. Love from venezuela
@CodersTape
@CodersTape 5 жыл бұрын
Dale. Gracias.
@GurvinderSingh-bz9ys
@GurvinderSingh-bz9ys 4 жыл бұрын
Can you please guide and build a similar video on the business model of "User", "Address" and "Company" tables. Scenario here is that 1. an address can belong to a user and at the same time belongs to a Company, 2. a company can have many branch address and 3. a user can have many billing address (like an amazons many shipping address). In an market place there are many user so a users can be a vender with business address and user can have an non-business address who does not belong to a company and is a buyer in that marketplace. Requesting you to please structure it. As this is three way relationship explanation needed. I believe this video will be very help full to me and to many others. !!!!!
@patrickgomes2261
@patrickgomes2261 4 жыл бұрын
I think having different tables when you have a big website would be better to maximize the time... Imagine searching in a table with comments from posts, videos and other things all together... Of course you can take based on the type but even though I think it would take more time than a separated table
@sumitwadhwa8823
@sumitwadhwa8823 4 жыл бұрын
excellent video. btw, performance-wise, what is more suggestible as the application grows: polymorphic or multiple association tables?
@Patrickdaawsome
@Patrickdaawsome 4 жыл бұрын
Do you have a suggestion on keeping order of images of a One-to-Many relationship? Let's say a post usually has a header and footer image. Would you add an incrementing integer column and use code to check it 1 or 2 (like an enum) or would you have a better way to implement this?
@graceresourcecentre1200
@graceresourcecentre1200 4 жыл бұрын
Thank you for this tutorial , just follow-up question this type of relationship is reliable enough? vs the common relationship practice ?
@gevorgnikoghosyan7252
@gevorgnikoghosyan7252 5 жыл бұрын
excuse me for a stupid question)) this awesome thing works only on --v 6? i have project 5.7 but damn i want to do that way :D
@CodersTape
@CodersTape 5 жыл бұрын
Gevorg Nikoghosyan 100% works in Laravel 5.7. This is not new to L6
@gevorgnikoghosyan7252
@gevorgnikoghosyan7252 5 жыл бұрын
@@CodersTape thanks :) by the way you are the best in explaining things) waiting for more advanced topics ) youre helping a lot !
@umerfarooqchattha5685
@umerfarooqchattha5685 5 жыл бұрын
Thanks
@milospetkovic9927
@milospetkovic9927 4 жыл бұрын
Great video/tutorial! I have a question regarding a database query performance. The database column "imageable_type" can't be used as foreign key to an appropriate table because it's used for different models. How it will work in case of many database records when foreign key/index is missing? Is it better to have a separate image table for each model in that case?
@SabinSipai
@SabinSipai 4 жыл бұрын
first of all thank you for explaining so beautifully. Can i ask how do you fetch the data according to tags? i.e. show video according to tags and show post according to same tag? Thank you for making this video
@kisstamas6675
@kisstamas6675 3 жыл бұрын
hi! thank you for that video it is awesome! I have some question: What if that morph tables (comments, images, tags.) contains a lot of records? Does the queries will be run slowly? Thanks
@ronssijei
@ronssijei 4 жыл бұрын
What about creating a history of user's payments and visitor's visits? Is the morphing a right way to do it?
@josibee
@josibee Жыл бұрын
At 8:25, if you run $user->image()->create(['url' = > 'profile.jpg']); you will have more images for the user. How do you make a constraint that no record should be created for the user if one already exists?
@SethSetiadha
@SethSetiadha 3 жыл бұрын
When is the best time kr what case is best practice to use polymorphic?
@md.imrulhasan8757
@md.imrulhasan8757 3 жыл бұрын
In 8:50 You said, "So this image can not belong to more than one 'User'.". What does it mean? Is it mean a profile picture with a unique URL can not be used by more than a user? I query it. But it creates a unique image URL with two users. Do you clear me out?
@ehSamurai3483
@ehSamurai3483 3 жыл бұрын
So if 2 tables is related to one table, we create a polymorphic relationship right?
@SaranshDhingra
@SaranshDhingra 5 жыл бұрын
Hi! Great Videos :) Can you also include a video related to "Creating a custom queue driver", like instead of using DB/SQS/RabbitMQ we use filesystem or something else. I have a use case that I need to create one using STOMP from Amazon Mq, but there is no proper documentation on how to create one. Not even a package that works properly.
@vahidabedi9534
@vahidabedi9534 3 жыл бұрын
Tnx for your great videos. I have one question. What is the advantage of using polymorphism over using the scenario below: images table: -post_id -user_id ... (and we fill just one of the id columns based on use case)
@stevenstraker5105
@stevenstraker5105 2 жыл бұрын
This is another way of doing it, however, this requires specifying a column for individual relation. Polymorphism allows for dynamic relationships, so the database doesn't require changing each time a a new relationship type is added
@mememedia4788
@mememedia4788 5 жыл бұрын
Hi, What's the best way to create custom functions/helpers/library in Laravel?. Where can I write codes for reusable functions such as SMS notifications and other API calls to use in multiple controllers. If possible please make a video about it.
@codingstuff8305
@codingstuff8305 5 жыл бұрын
Hi Victor. Just a question for being sure... If my models are in a dedicate folder name Models for example do I have to put the full name space of a relationship declaration?
@CodersTape
@CodersTape 5 жыл бұрын
Yes. Or you’ll have to import the class up top with a use statement.
@codingstuff8305
@codingstuff8305 5 жыл бұрын
@@CodersTape OK thanks a lot!!
@mahmudrafid3910
@mahmudrafid3910 4 жыл бұрын
Please post new video. Eagerly waiting.
@ademolai9297
@ademolai9297 4 жыл бұрын
taggable_id remains 1 and unchanged. What's it supposed to be used for ?
@PunxTV123
@PunxTV123 5 жыл бұрын
what is the difference putting the image column in POST? is it faster there than creating new table.
@CodersTape
@CodersTape 5 жыл бұрын
I’m not following your question. Can you elaborate?
@PunxTV123
@PunxTV123 5 жыл бұрын
@@CodersTape I mean there is image column in posts table, and the data are url of images. so every query of user/posts need to left join right?
@aguiboubarry8316
@aguiboubarry8316 4 жыл бұрын
Hey guys, please assist me on the following: I have 3 models namely User, Lecturer and Student I want Student and Lecturer to extend from the User model. Is it something like Student and Lecturer belongTo User ?
@JiteshDhamaniya
@JiteshDhamaniya 4 жыл бұрын
Relationship is about Join in SQL.
@stevenstraker5105
@stevenstraker5105 2 жыл бұрын
I know this is quite late, but just in case (and for anyone else coming along), what you're referring to is class inheritance, rather than database relationships. Relationships would be more like a Student and their Classes, rather than a Student being a type of User, if that makes sense.
@christiansenmarcus
@christiansenmarcus 4 жыл бұрын
How would you do the inverse and query all tags that belong to a specific model?
@andersonmartins3862
@andersonmartins3862 4 жыл бұрын
Congratulations on the great video! How do I get relationship data using ELOQUENT in CONTROLLER?
@CodersTape
@CodersTape 4 жыл бұрын
Exactly the same way. Just fetch the record and grab its relationship
@andersonmartins3862
@andersonmartins3862 4 жыл бұрын
@@CodersTape Thanks! It works.
@bartomiejsobieszek432
@bartomiejsobieszek432 5 жыл бұрын
While explained very well, the feature itself is in my opinion a big no as it makes a strong connection between the database and code. You should rarely be in need to write the path to a class in database column
@jayantrawat5961
@jayantrawat5961 3 жыл бұрын
What if I want to upload multiple images for a single post. Like one for Thumbnails and another for the gallery?
@secwriteups
@secwriteups 4 жыл бұрын
How do you link comments to users in this case ? And, is it possible to make nested comments with this system ?
@chumarosawa
@chumarosawa 5 жыл бұрын
Excelents videos Victor, I have a question a litle bit diferent, how to handle the laravel version upgrade in your app?, suposse you have large app maked in laravel 5.5 and now you want to use laravel´s version 6
@CodersTape
@CodersTape 5 жыл бұрын
When upgrading from version to version, you will need to follow each guide and make the necessary changes from 5.5 to 5.6 and then from 5.6 to 5.7 and so on. There’s also a service called Laravel Shift which does the upgrade pretty automatic for you but it costs money. Might be worth looking into it.
@neerajsinghtangariya2587
@neerajsinghtangariya2587 4 жыл бұрын
Hello sir, For creating the task is done, but how to update this existing records in polymorphic.
@mundix1
@mundix1 3 жыл бұрын
hi, how i can verify if for example relation User -> Image, hasImage(Image $image) ? to check before assign again ?
@ShibbirAhmedRaihan
@ShibbirAhmedRaihan 5 жыл бұрын
First of all, Thanks for your awesome video. But What about if user delete model then how OnUpdate or OnDelete Cascase work?
@CodersTape
@CodersTape 5 жыл бұрын
You’d need to set those constraints at the database level.
@ShibbirAhmedRaihan
@ShibbirAhmedRaihan 5 жыл бұрын
@@CodersTapeThanks for your reply. Can you explain this? or can you make a tutorial about this?
@CodersTape
@CodersTape 5 жыл бұрын
@@ShibbirAhmedRaihan I'll make sure to add it when we revisit the topic for Laravel 6 Beginner series.
@ShibbirAhmedRaihan
@ShibbirAhmedRaihan 5 жыл бұрын
@@CodersTape Okay Sir
@tothebone4613
@tothebone4613 4 жыл бұрын
is there any course from you to create one page wih multiple crud many to many relation ship, its like 1 page profile to add lot of function such as add document add position add assignment etc,
Laravel 6 Advanced - e4 - Facades
24:33
Coder's Tape
Рет қаралды 61 М.
Laravel 6 Advanced - e2 - View Composers
22:12
Coder's Tape
Рет қаралды 69 М.
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 191 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 14 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 66 МЛН
Challenge matching picture with Alfredo Larin family! 😁
00:21
BigSchool
Рет қаралды 41 МЛН
Eloquent Polymorphic Relations: Properly Explained
9:56
Laravel Daily
Рет қаралды 40 М.
Laravel: BelongsTo vs Polymorphic? Let's Test!
14:09
Laravel Daily
Рет қаралды 26 М.
Laravel 6 Advanced - e7 - Repository Pattern
23:24
Coder's Tape
Рет қаралды 103 М.
Laravel 6 Advanced - e1 - Service Container
23:27
Coder's Tape
Рет қаралды 273 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 139 М.
Write Laravel, not PHP (feat. Aaron Francis) | 029
58:45
Backend Banter
Рет қаралды 15 М.
Laravel 6 Advanced - e6 - Pipelines
28:53
Coder's Tape
Рет қаралды 52 М.
5 tips for supercharged Laravel Eloquent queries
16:29
Andrew Schmelyun
Рет қаралды 68 М.
Laravel 6 Advanced - e5 - Macros
19:04
Coder's Tape
Рет қаралды 34 М.
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 191 МЛН