whenever I get a User from the database, I want to say “if this field for this user is empty…”
This is for the current user and every user that is retrieved from the database. Where would I put this if statement? Would it go in the model or is there a generic function that I can use the in the user controller before rendering any user?
Many thanks
You can use
afterFindin your model to perform such checks, and this will work for data returned for find operation, like:Note:- You can define such functions in your Model Class or AppModel as well.