What does `->evaluate()` do?
I see this all over the code base but not really understanding entirely what it's doing. Can someone explain?
Solution:Jump to solution
It handles callbacks that are passed into methods. Ie, if you pass a closure in to something like ->required() the evaluate will run that closure when using $isRequired() in a blade view for example. It also handles dependency injection.
3 Replies
Solution
It handles callbacks that are passed into methods. Ie, if you pass a closure in to something like ->required() the evaluate will run that closure when using $isRequired() in a blade view for example. It also handles dependency injection.
Dan did a video series on Laracasts where he explains in detail how
evaluate()
came about and how it works. https://laracasts.com/series/build-advanced-components-for-filamentAwesome, I'll check that out. Thanks.