Laravel Eloquent Relationships: Polymorphic Relations (6/6)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 พ.ย. 2024

ความคิดเห็น • 40

  • @ArafatX
    @ArafatX 9 ปีที่แล้ว +1

    I read the documentation about this. It was very hard to understand and I stopped there. Then I gone through to your video and read back the documentation and now I'm 100% got it!!! thanks a lot!.

  • @ktmsulaim
    @ktmsulaim 4 ปีที่แล้ว

    Your explanation made these complex methods so easy! Thanks alot!

  • @jacobalexander5340
    @jacobalexander5340 10 ปีที่แล้ว +4

    phpacademy, I love you!
    5 and 6 video is just awesome, everything explained so clear.

  • @jmac217x
    @jmac217x 10 ปีที่แล้ว +5

    Great little series

    • @codecourse
      @codecourse  10 ปีที่แล้ว +3

      Thanks, glad you liked it :)

  • @melomancheto2761
    @melomancheto2761 6 ปีที่แล้ว

    This playlist is awesome you helped me a lot! I know you are trying to make the short and easy to understand, but If you take like 1 - 2 more minutes to show people and track down how it works I mean the naming convention and what refers to what will be awesome. Because now atleast I need to go over that part to understand it fully.

  • @ArafatX
    @ArafatX 9 ปีที่แล้ว +6

    If you have problem the comment section is not display in laravel 5, you need to add App\User or App\Article in the commentable_type. Laravel 5 depends heavily in the namespace. I'm not sure why.. perhaps it's bug.

    • @ppllmmookknn
      @ppllmmookknn 7 ปีที่แล้ว

      Thank u!!!

    • @taslimsuman
      @taslimsuman 7 ปีที่แล้ว

      The same it is not display the comments. Im using 5.4

  • @vollthegreat1647
    @vollthegreat1647 8 ปีที่แล้ว +2

    will be any other videos like this with laravel? Great video,great voice!

  • @rafanbnb
    @rafanbnb 5 ปีที่แล้ว +1

    This video is awesome!

  • @HusamekhraweshNet
    @HusamekhraweshNet 8 ปีที่แล้ว

    will be any other videos like this with laravel? Great video,great voice!
    very nice job
    thank you

  • @yurikryba
    @yurikryba 8 ปีที่แล้ว

    Great explanation! Thank you for this.

  • @PaulGertz
    @PaulGertz 9 ปีที่แล้ว

    Hi there ! Thanks for your video, well explained.
    I'm looking for a way to display all the comment of one commentable type. So I don't want to display the comments of one user profile, but to display all the comments made on users profiles. How would you do this ?
    Something like User::all()->comments() ... But that seems to magic to be allowed =)
    Thank you in advance if you have any advice !

  • @Gratiafide
    @Gratiafide 8 ปีที่แล้ว

    How to save this relationship from within the controller? I've tried using the save(), sync(), and insert() methods in a many-to-many polymorphic relationship and the first one works, but then subsequent attempts with the same user fails with a primary key error message.

  • @AliRaza77
    @AliRaza77 7 ปีที่แล้ว

    First of all thank you, because you are doing great work. I need some suggestion so please help me.
    Situation:
    I have user model with roles (admin, super-admin, customer and seller etc ),
    Product model linked with users (` oneToMany relationships ).
    How to save orders for both seller and purchaser in order model?
    Like: list all orders of a particular user with role seller and also list for a customer.
    Because one order is linked to two users (Seller and purchaser).

  • @leventefarkas8256
    @leventefarkas8256 7 ปีที่แล้ว

    It's only read from CRUD. Has video from create and update with relations?

  • @freemqwer
    @freemqwer 8 ปีที่แล้ว

    Great tutorial series

  • @xenicmark
    @xenicmark 8 ปีที่แล้ว

    This was really awesome!

  • @varunsharma-varun
    @varunsharma-varun 8 ปีที่แล้ว

    Awesome tutorial.

  • @ervinkahorere849
    @ervinkahorere849 9 ปีที่แล้ว

    Great help , thank you.

  • @murilolivorato1489
    @murilolivorato1489 8 ปีที่แล้ว

    Hello My friend , does have MorphMany() as well in laravel 5 ? or this is just for laravel 4.2 ? thanks

    • @JLaurel
      @JLaurel 7 ปีที่แล้ว

      it has, just... If you have problem the comment section is not display in laravel 5, you need to add App\User or App\Article in the commentable_type. Laravel 5 depends heavily in the namespace. I'm not sure why.. perhaps it's bug.

  • @mizotech553
    @mizotech553 5 ปีที่แล้ว +1

    if $users->comments return empty collection put App\User instead of User in commentable_type

  • @WarrioW
    @WarrioW 7 ปีที่แล้ว

    how do you synch such a relation?

  • @vinr
    @vinr 10 ปีที่แล้ว +1

    Super!!!

  • @AversiePzz
    @AversiePzz 10 ปีที่แล้ว

    Wouldn't it be less confusing to change "commentable_id" to "article_id"? Or am I missing something?

    • @codecourse
      @codecourse  10 ปีที่แล้ว +2

      It's commentable because it's a polymorphic relationship, meaning comments can be added to anything, articles, profiles, whatever. So, the commentable_id could be an article's ID, but the commentable_type would be Article or Codecourse\Articles\Article if it were namespaced.
      Hope that cleared things up.

    • @AversiePzz
      @AversiePzz 10 ปีที่แล้ว

      Ohhh ok :) Thanks I get it now :)

    • @55jonesc
      @55jonesc 9 ปีที่แล้ว

      +Codecourse Realising I had to put App\Article took me way too long, great little series really helped me out. Thanks :)

  • @felixgolindano8913
    @felixgolindano8913 8 ปีที่แล้ว

    Why don't you set the foreign keys? Is there a reason?

  • @prathameshkhadakban1485
    @prathameshkhadakban1485 7 ปีที่แล้ว

    Great!!

  • @ExonicGamer
    @ExonicGamer 4 ปีที่แล้ว

    so easy way.

  • @codexabyte
    @codexabyte 6 ปีที่แล้ว

    big cheese 👍🏻

  • @ArafatX
    @ArafatX 9 ปีที่แล้ว

    I have a question, what if I want to get all reviews and display in one page together with who made the review. Example loop $reviews as $review, then $review->body (this works), but $review->users->name (this does not work). how do you define this relationship?

    • @jeyemGFX
      @jeyemGFX 9 ปีที่แล้ว

      +Arafat X You can watch video 1 of the series - it covers exactly what you are lucking for :)

  • @judgementday2022
    @judgementday2022 8 ปีที่แล้ว

    Would be nice if you used Controller Classes and relation. Otherwise this course is just a waste of time