MarvinLabs\SetupWizard\Triggers\TriggerHelper::shouldWizardBeTriggered PHP Méthode

shouldWizardBeTriggered() public static méthode

public static shouldWizardBeTriggered ( ) : boolean
Résultat boolean Returns true if the wizard has to be launched
    public static function shouldWizardBeTriggered()
    {
        // Get triggers from configuration and redirect to wizard if any of them fires
        $triggerClasses = config('setup_wizard.triggers');
        foreach ($triggerClasses as $tc) {
            /** @var WizardTrigger $trigger */
            $trigger = new $tc();
            if ($trigger->shouldLaunchWizard()) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @param  string|null              $guard
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (TriggerHelper::shouldWizardBeTriggered()) {
         return $this->redirectToWizard();
     }
     return $next($request);
 }