Utilities - Alerts
Alerts provides a Facade (installed as part of the normal insetallation process) which allows a developer to display alerts on crud pages.
The alerts are stored in the session and removed once they are displayed.
Raising an Alert
Alert::add('I am a banana.');
Alert Styles
You can override the style of the alert depending on the situation.
Alert::add('I am a banana. This is a problem.', 'error');
Alert::add('I have eaten a banana.', 'success');
Alert::add('There may be the posibility of bananas.', 'warning');
Alert::add('I would like to talk to you about bananas.', 'info');
Alert::add('This message is Ensō pink.', 'primary');
There are also shorthand functions for these styles.
Alert::error('I am a banana. This is a problem.');
Alert::success('I have eaten a banana.');
Alert::warning('There may be the posibility of bananas.');
Alert::info('I would like to talk to you about bananas.');
Alert::primary('This message is Ensō pink.');
Creating Alerts from Javascript
You can also create alerts dynamically from Javascript.
enso.alerts.add("Dynamic alert message.", "error");
Adding alerts to the page
If you are making custom views for your Enso backend, you may need to manually include the enso alerts view:
@include('enso-crud::partials.alerts')