コード例 #1
0
ファイル: Field.php プロジェクト: laralite/form
 /**
  * Use values stored in Form to populate the current field
  */
 private function repopulate($fallback = null)
 {
     // Get values from POST, populated, and manually set value
     $post = $this->app['form']->getPost($this->name);
     $populator = $this->form ? $this->form->getPopulator() : $this->app['form.populator'];
     $populate = $populator->get($this->bind ?: $this->name);
     // Assign a priority to each
     if (!is_null($post)) {
         return $post;
     }
     if (!is_null($populate)) {
         return $populate;
     }
     return $fallback ?: $this->value;
 }
コード例 #2
0
ファイル: MethodDispatcher.php プロジェクト: laralite/form
 /**
  * Dispatch a call over to Form
  *
  * @param string $method     The method called
  * @param array  $parameters Its parameters
  *
  * @return Form
  */
 public function toForm($method, $parameters)
 {
     // Disregards if the method doesn't contain 'open'
     if (!Str::contains($method, 'open') and !Str::contains($method, 'Open')) {
         return false;
     }
     $form = new Form\Form($this->app, $this->app['url'], $this->app['form.populator']);
     return $form->openForm($method, $parameters);
 }