Skip to content

Checking if messages have been created

Dylan Anderson edited this page Jun 24, 2016 · 3 revisions

Feedback::has(); can be used to determine if messages have been set. You can pass a selector to has() to check particular types or namespaces:

/* checks if any messages have been set at all */
Feedback::has();

/* checks if any messages of type "error" have been set */
Feedback::has('error'); 

/* Checks if any messages of type "error", with the "user" 
   namespace have been set */
Feedback::has('error.user');

/* Checks if any message of any type, with the "user" 
   namespace have been set */
Feedback::has('.user');

/* Checks if any message of the type "error" NOT in the "user" 
   namespace have been set */
Feedback::has('error!user');