dynamically hiding actions - caching issue??
Hi guys, I have a permission service which allows admins to edit certain models. I return an array of actions if
canAdmin($modelClass)
is true, and an empty array if false. So it seems to work and the buttons have disappeared, but upon switching back to admin, the buttons dont reappear, and indeed, upon reverting my code back to the resource with hard coded buttons still doesn't bring them back! Is there some sort of caching issue? because i was sure reverting my code would work :-p

9 Replies
diff of the original code, which also doesn't show the buttons now

Ok it's ctually working perfectly on one of my other resources so it must be something particular with that resource that is the problem, thanks anyway
Solution
I guess you should use
->visible()
/->hidden()
on the Action insteadActions are cached as far as I know
ah, thanks!
Hope that fixes your issue.
because yes the one it worked perfectly on? now acting erratically
this ought to work 🙂 Thanks again!
Great. You're welcome
Thanks @Dennis Koch it worked a treat!