summaryrefslogtreecommitdiffstats
path: root/src/Controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Controller.php')
-rw-r--r--src/Controller.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Controller.php b/src/Controller.php
index ddec2c0..f7ea6f3 100644
--- a/src/Controller.php
+++ b/src/Controller.php
@@ -23,6 +23,12 @@ abstract class Controller
protected $response = null;
/**
+ * Flash
+ * @var Flash
+ **/
+ protected $flash = null;
+
+ /**
* Run the controller
*
* @return ResponseInterface
@@ -65,6 +71,21 @@ abstract class Controller
}
/**
+ * Set the flash message and/or return the flash object.
+ *
+ * @param mixed $type flash type, eg. 'error', 'notice' or 'success'
+ * @param mixed $message flash message
+ * @return Flash
+ */
+ public function flash($type = null, $message = null)
+ {
+ if (!isset($this->flash)) $this->flash = new Flash();
+ if ($type && $message) $this->flash->set($type, $message);
+
+ return $this->flash;
+ }
+
+ /**
* Check if response is 2xx succesful, or empty
*
* @return boolean