protected function checkout(MessageBag $messages)
    {
        $html       = '';
        $hasError   = false;
        $hasSuccess = false;

        foreach (['error', 'info', 'success', 'warning'] as $key) {
            if ($messages->has($key)) {
                $hasError   = (!$hasError && $key == 'error');
                $hasSuccess = (!$hasSuccess && $key == 'success');

                $flashMessages = $messages->setFormat('<div class="activity-item"> <i class="fa ' . $this->mapping[$key] . '"></i> <div class="activity">:message</div>')->get($key);


                array_walk($flashMessages, function($current) use ($key, &$html) {
                    $html .= "generate('{$key}', '{$current}');\n";
                });
            }
        }
        return $html;
    }