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!.
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.
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.
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 !
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.
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).
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.
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.
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?
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!.
Your explanation made these complex methods so easy! Thanks alot!
phpacademy, I love you!
5 and 6 video is just awesome, everything explained so clear.
Great little series
Thanks, glad you liked it :)
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.
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.
Thank u!!!
The same it is not display the comments. Im using 5.4
will be any other videos like this with laravel? Great video,great voice!
This video is awesome!
will be any other videos like this with laravel? Great video,great voice!
very nice job
thank you
Great explanation! Thank you for this.
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 !
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.
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).
It's only read from CRUD. Has video from create and update with relations?
Great tutorial series
This was really awesome!
Awesome tutorial.
Great help , thank you.
Hello My friend , does have MorphMany() as well in laravel 5 ? or this is just for laravel 4.2 ? thanks
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.
if $users->comments return empty collection put App\User instead of User in commentable_type
how do you synch such a relation?
Super!!!
Wouldn't it be less confusing to change "commentable_id" to "article_id"? Or am I missing something?
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.
Ohhh ok :) Thanks I get it now :)
+Codecourse Realising I had to put App\Article took me way too long, great little series really helped me out. Thanks :)
Why don't you set the foreign keys? Is there a reason?
he must be following the foreign key convention so no need to define explicitly.
Good! Thanks!
Felix Golindano welcome :)
Great!!
so easy way.
big cheese 👍🏻
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?
+Arafat X You can watch video 1 of the series - it covers exactly what you are lucking for :)
Would be nice if you used Controller Classes and relation. Otherwise this course is just a waste of time