Welcome Guest, Not a member yet? Register   Sign In
Where is the Best Place for Cron Methods ?
#5

it sounds like the methods you're referring to are related to database maintenance tasks, such as cleaning up old entries. Since these methods don't require authentication or views, it's best to keep them separate from your controllers and views.

Here are a few options for where you could place these methods:

Models: If the methods are directly related to database operations, you could consider placing them in the relevant models. For example, if you have a "User" model and a "Post" model, you could create methods in each model to clean up old user and post entries, respectively.

Helper classes: Another option is to create a separate helper class specifically for these maintenance tasks. This would allow you to keep the methods separate from your models and controllers, making them easier to manage and maintain.

Custom command: Finally, you could create a custom command that can be run from the command line. This would allow you to automate these maintenance tasks and run them independently of your application's controllers and views.

Ultimately, the best approach will depend on your specific application architecture and needs. However, in general, it's a good idea to keep maintenance tasks like these separate from your main application logic, to avoid cluttering your controllers and models and making it more difficult to maintain your codebase.
Reply


Messages In This Thread
RE: Where is the Best Place for Cron Methods ? - by SharphSonirtm - 03-27-2023, 11:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB