Laravel News: Factory Callbacks and Closure-Based Guards in Laravel
syndicated from www.phpdeveloper.org
on June 12, 2018
On the Laravel News site, there's an article posted covering the use of factory callbacks and closures in guards in Laravel. This feature was snuck into a recent release and allows you to provide a bit more dynamic functionality to your models and guards.
Two undocumented (before today anyhow) features were recently added to the Laravel 5.6 documentation, and they are both fantastic!
The post details each of the two new additions starting with the factory callbacks allowing you to perform additional tasks when a model is made or created (code examples included). The guard changes allowing closures and the Auth::viaRequest
method to define new guard drivers.