Ejemplo n.º 1
0
 /**
  * Flash a general message to the session data.
  *
  * This method allows you to conveniently pass messages to views.
  *
  * <code>
  *		// Redirect and flash messages to the session
  *		return Redirect::to('item_list')->with_message('Your item was added.');
  *
  *    // Flash a message with a type
  *		return Redirect::to('item_list')->with_message('Your item was added.', 'success');
  * </code>
  * 
  * @param  string $text
  * @param  string $type
  * @return Redirect
  */
 public function with_message($text, $type = '')
 {
     $messages = Session::get('messages', new TypedMessages());
     $messages->add_typed($text, $type);
     Session::flash('messages', $messages);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Add an item to the session flash data.
  *
  * This is useful for "passing" status messages or other data to the next request.
  *
  * <code>
  *		// Create a redirect response and flash to the session
  *		return Redirect::to('profile')->with('message', 'Welcome Back!');
  * </code>
  *
  * @param  string          $key
  * @param  mixed           $value
  * @return Redirect
  */
 public function with($key, $value)
 {
     if (Config::get('session.driver') == '') {
         throw new \Exception('A session driver must be set before setting flash data.');
     }
     Session::flash($key, $value);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Add a notification of any sort
  *
  * @param  string  	$type
  * @param  string  	$message
  * @param  int  	$time
  * @param  boolean  $close
  * @return void
  */
 protected static function add($type, $message, $time, $close)
 {
     static::$notifications[] = array('type' => $type, 'message' => $message, 'time' => $time, 'close' => $close);
     Session::flash('notifications', static::$notifications);
 }
Ejemplo n.º 4
0
 public static function flush()
 {
     Session::flash(Input::old_input, array());
 }