예제 #1
0
 /**
  * Use to populate a form field. Loads the field's value from 
  * flashed input data, if that's not present it loads the value
  *
  * <code>
  *		// Get the "email" item from the form's field data array
  *		$email = ExampleForm::get( 'email' );
  *
  *		// Return a default value if the specified item doesn't exist
  *		$email = ExampleForm::get( 'email', 'not listed' );
  * </code>
  *
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 public static function populate($field_name, $default = null)
 {
     // prevent need to manually load input when populating forms
     if (empty(static::$field_data)) {
         static::unserialize_from_session();
     }
     // return input flash data, fallback on persistent for data, fallback on default
     return Input::old($field_name, static::get($field_name, $default));
 }