-
Notifications
You must be signed in to change notification settings - Fork 1
Creating messages
Dylan Anderson edited this page Jun 24, 2020
·
3 revisions
Creating a message is as simple as:
Feedback::error('Your profile could not be saved.');// or
Feedback::success('The file was uploaded!');// or
Feedback::foo('Bar');
To create a message of any type (ex: "error", "success", "foo"), simply call that method. Feedback's __callStatic()
magic method then creates your message of that type.
You may want to namespace messages so you can display them in different places, or do different things with them. To namespace a message, pass the namespace as the first argument, and your message as the second. For example:
Feedback::error('technical','Database could not be contacted due to error #5733');
Feedback::error('user','Whoops, we had some technical problems');
In the example above, you could possibly send the "technical" error to the system administrator, and display the "user" error to the user.