Пример #1
0
 public function __construct()
 {
     if (!isset(static::$errors)) {
         if (Session::started() and Session::has('errors')) {
             static::$errors = Session::get('errors');
         } else {
             static::$errors = new Messages();
         }
     }
 }
Пример #2
0
 public function __construct()
 {
     // If a session driver has been specified, we will bind an instance of the
     // module error message container. If an error instance
     // exists in the session, we will use that instance.
     if (!isset(static::$errors)) {
         if (Session::started() and Session::has('errors')) {
             static::$errors = Session::get('errors');
         } else {
             static::$errors = new Messages();
         }
     }
 }
Пример #3
0
 public function __construct($view, $data = array())
 {
     parent::__construct($view, $data);
     // If a session driver has been specified, we will bind an instance of the
     // message container to every view. If a container instance
     // exists in the session, we will use that instance.
     $key = 'messages';
     if (!isset($this->data[$key])) {
         if (Session::started() and Session::has($key)) {
             $this->data[$key] = Session::get($key);
         } else {
             $this->data[$key] = new TypedMessages();
         }
     }
 }
Пример #4
0
 /**
  * Create a new view instance.
  *
  * <code>
  *		// Create a new view instance
  *		$view = new View('home.index');
  *
  *		// Create a new view instance of a bundle's view
  *		$view = new View('admin::home.index');
  *
  *		// Create a new view instance with bound data
  *		$view = new View('home.index', array('name' => 'Taylor'));
  * </code>
  *
  * @param  string  $view
  * @param  array   $data
  * @return void
  */
 public function __construct($view, $data = array())
 {
     $this->view = $view;
     $this->data = $data;
     $this->path = $this->path($view);
     // If a session driver has been specified, we will bind an instance of the
     // validation error message container to every view. If an errors instance
     // exists in the session, we will use that instance.
     //
     // This makes error display in the view extremely convenient, since the
     // developer can always assume they have a message container instance
     // available to them in the view's variables.
     if (!isset($this->data['errors'])) {
         if (Session::started() and Session::has('errors')) {
             $this->data['errors'] = Session::get('errors');
         } else {
             $this->data['errors'] = new Messages();
         }
     }
 }
Пример #5
0
 /**
  * Create a new view instance.
  *
  * <code>
  *		// Create a new view instance
  *		$view = new View('home.index');
  *
  *		// Create a new view instance of a bundle's view
  *		$view = new View('admin::home.index');
  *
  *		// Create a new view instance with bound data
  *		$view = new View('home.index', array('name' => 'Taylor'));
  * </code>
  *
  * @param  string  $view
  * @param  array   $data
  * @return void
  */
 public function __construct($view, $data = array())
 {
     $this->view = $view;
     $this->data = $data;
     // In order to allow developers to load views outside of the normal loading
     // conventions, we'll allow for a raw path to be given in place of the
     // typical view name, giving total freedom on view loading.
     if (starts_with($view, 'path: ')) {
         $this->path = substr($view, 6);
     } else {
         $this->path = $this->path($view);
     }
     // If a session driver has been specified, we will bind an instance of the
     // validation error message container to every view. If an error instance
     // exists in the session, we will use that instance.
     if (!isset($this->data['errors'])) {
         if (Session::started() and Session::has('errors')) {
             $this->data['errors'] = Session::get('errors');
         } else {
             $this->data['errors'] = new Messages();
         }
     }
 }
Пример #6
0
 /**
  * Unserialize the model's field data from a session
  */
 private static function unserialize_from_session()
 {
     if (Session::has('serialized_field_data[' . get_called_class() . ']')) {
         static::$field_data = unserialize(Session::get('serialized_field_data[' . get_called_class() . ']'));
     }
 }
Пример #7
0
 public function __construct($view, $data = array())
 {
     $this->view = $view;
     $this->data = $data;
     if (starts_with($view, 'path: ')) {
         $this->path = substr($view, 6);
     } else {
         $this->path = $this->path($view);
     }
     if (!isset($this->data['errors'])) {
         if (Session::started() and Session::has('errors')) {
             $this->data['errors'] = Session::get('errors');
         } else {
             $this->data['errors'] = new Messages();
         }
     }
 }
Пример #8
0
 /**
  * Create a new module instance.
  *
  * <code>
  *      // Create a new module instance
  *      $module = new Modules\Module('registration');
  *
  *      // Create a new module instance with a path
  *      $module = new Modules\Module('registration', 'registration/extended');
  *
  *      // Create a new module instance with a full path
  *      $module = new Modules\Module('registration', 'path: /var/www/project/registration');
  * </code>
  *
  * @param  string  $module
  * @param  string  $path
  * @return void
  */
 public function __construct($module_slug, $path = null)
 {
     $this->slug = $module_slug;
     $ins = \Laravel\Config::get('installed_modules.' . $module_slug);
     $this->installed = isset($ins) and !empty($ins) ? true : false;
     $this->enabled = \Laravel\Bundle::exists($this->slug);
     $this->installer = Installer::make($module_slug);
     // if path starts with "path: "
     // its a custom path
     if (!isset($path)) {
         $this->path = path('bundle') . $this->slug . DS;
     } else {
         if (starts_with($path, 'path: ')) {
             $this->path = substr($path, 6);
         } else {
             // sets the path to modules
             // folder + path
             // module with different folder name?
             $this->path = path('bundle') . $path;
         }
     }
     // If a session driver has been specified, we will bind an instance of the
     // module error message container. If an error instance
     // exists in the session, we will use that instance.
     if (!isset($this->errors)) {
         if (Session::started() and Session::has('errors')) {
             $this->errors = Session::get('errors');
         } else {
             $this->errors = new Messages();
         }
     }
 }
Пример #9
0
 /**
  * __construct
  *
  * @return void
  */
 public function __construct()
 {
     $this->errors = Session::has('errors') ? Session::get('errors') : new Messages();
 }