Answer the question
In order to leave comments, you need to log in
How to create a frequently used component?
Good evening!
What I want:
The site will use comments on something (chat, news, forum, etc.) in several places. In order not to duplicate the same code in all these modules, I want to create a comment component that I will simply attach to different modules in the future. It is necessary not only to create a separate view (this is understandable), but also to create on the back-end side (class or trait, maybe). It is planned then simply in the method to set as a parameter (or there will be several of them) just the name of the table.
Example in Laravel:
Pagination in Laravel is done in a similar way. But it’s a little tricky there, so I want to hear the opinion and approximate solutions from experts.
--------
Can you please tell me how to implement something like this in a smart and simple way?
Answer the question
In order to leave comments, you need to log in
The documentation describes exactly your case: https://laravel.com/docs/5.7/eloquent-relationship...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question