Skip to content

Toasts

User notifications can be sent by using the laracasts/flash. These are then displayed as CoreUI-Toasts.

Official documentation

In addition to the following documentation, the official documentation for the packages used provides plenty of material.

Set title

laracasts/flash differentiates between modal and non-modal notifications. However, in this application all notifications are put out as modal toasts. If no title is given, the translated urgency of the message (success, info, warning oder danger) is displayed instead. The title can be set in one of the following ways.

<?php
class Controller extends \Illuminate\Routing\Controller
{
    public function index()
    {
        flash('body')->overlay(null, 'title');
        flash('body')->overlay(title: 'title');
        flash()->overlay('body', 'title');
        return redirect('/');
    }
}
return (new Controller())->index();