See it as the same way the DispatchesJobs
and the ValidatesRequests
traits work. It adds behavior to each controller so we can send messages to the user when the next request is resolved. This is an ideal use case for a trait.
If you look at the actual trait you'll see that we're indeed adding the message to the session. But we're hiding it behind convenient helper methods.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community