Best practice to access other controllers methods
See original GitHub issueWhat will be the best practice to access methods of one controller from another without creating a new instance?
For example I want to access methods of SomethingController
from StartController
which displays the ‘/start’ menu.
In previous version there was a method $.routeTo('/something')
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Best practice accessing other controller method - Laracasts
Another option is to create a trait containing the "common code" and use that trait in each controller that needs it giving you...
Read more >Is it good practise to access methods of one controller from ...
It's not a question of good and bad. Sometimes it's just necessary. The most common ways are: Define good interfaces between controllers ......
Read more >Access Controller method from another controller in Laravel 5
The best approach will be to create a trait (e.g. in app/Traits ), implement the logic there and tell your controllers to use...
Read more >10 Things You Should Avoid in Your ASP.NET Core Controllers
Data Access Logic · Business Logic · Mapping Model Classes Manually · Exception Handling · Repetitive Logic (Action Filters) · Manual Authorization.
Read more >Action Controller Overview - Ruby on Rails Guides
It is a best practice to lower the visibility of methods (with private or protected ) which are not intended to be actions,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Konfuze Hi! There is no such opportunity yet, but i will add
routeTo
method soon.@osadchiynikita and how to route? Where I can define the route?