Last updated
Last updated
Create a with_msg(["message" => ""])
. Alert types example [ default, primary, success, warning, danger ]
to give colors to the message to be shown.
After you set a with_msg()
you can now show it to the views using the alert_msg()
helper function. This helper function will display as alert and unset/removes
the alert when refreshing the page.
Just echo the alert_msg()
helper function in your views like this.
Note:
that the default color of the alert message is info
You can display errors using the loop to customized the looks of the alerts. Error:any()
contains all the message produce by the applciation.
when using this method, make sure the alert message is dismissable everytime you refresh the page. To do that we need to add a clear()
method above the footer include at the bottom of our file.
Now we want users to know what's the status of their request by displaying an alert message.