lundi 17 octobre 2016

Detect if running from middleware in Laravel

Is there a way to detect if my code is running from a Middleware. I have a helper that get's called from everywhere for date conversions. In that helper, I check for route names \Route::current()->getName() or if running from console \App::runningInConsole().

When my middleware calls the helper, I get an error with \Route::current()->getName() since \Route::current() is null

Is there a way of knowing if code executed from my middleware? Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire